Java Super keywordThe Super keyword is similar to this, this is used to represent an instance of the current class, and super is used to represent the parent class.
Super can be used in subclasses, by Dot (.) To get the member variables and methods of the parent class. Super
Similarities and differences between Super and this: super (parameter): Call one of the constructors in the base class (which should be the first statement in the constructor) this (argument): Call another constructor in this class (which should be the first statement in the constructor) Super: It refers to members in the immediate parent class of the current obj
The definition of super in official documents is not so much, it basically means that returning a proxy object allows you to invoke some inherited methods, and the mechanism of lookup follows the MRO rules, the most common of which is shown in the following example:
Class C (B): def method (self, arg): super (C, Self). Method (ARG)
Subclass C Overrides a method of the same name in the parent class B,
Super Patrol Horse Detection system is the thousand Cloud's Data Security Laboratory (www.sucop.com) produced a free horse detection software. The software is designed to check for Web servers being hacked to grow script trojans and Web pages being embedded in malicious links.
Click here to download
Super Patrol Horse Detection system is a super Pat
By defining a method or member with static, it provides some convenience for us to program, and to some extent it is similar to global functions and global variables in C language. However, it is not said that with this convenience, you can use everywhere, if so, you need to seriously consider whether you are using object-oriented thinking programming, whether your own program is object-oriented.
OK, now let's discuss the meaning and usage of the two keywords Thissuper.
In Java, this usually ref
By defining a method or member with static, it provides some convenience for us to program, and to some extent it is similar to global functions and global variables in C language. However, it is not said that with this convenience, you can use everywhere, if so, you need to seriously consider whether you are using object-oriented thinking programming, whether your own program is object-oriented.
OK, now let's discuss the meaning and usage of the two keywords Thissuper.
In Java, this usually ref
Super Ubuntu 2008.11 is based on Ubuntu 8.10, which is called "super" because it integrates a large number of standard Ubuntu 8.10 software, tools and applications, such as Super Ubuntu 2008.11 as Op Enoffice 3, which supports Microsoft 2007 's file format, integrates Mplayer, plays the most popular audio/video formats such as DVDs, integrates Wine and wine-doors
In-depth analysis of the usage of the super keyword in Python programming, pythonsuper
There are not many definitions about super in the official document. It generally means that a proxy object is returned so that you can call some inherited methods. The search mechanism follows the mro rules, the following example shows the most common scenarios:
class C(B): def method(self, arg):
defined for this purpose.static variablesStatic variables are similar to static methods. All such instances share this static variable, that is, when the class is loaded, only one storage space is allocated, and all objects of this class can manipulate this block of storage space, although for final it is a matter of course . Look at the following code:classvalue{Static intC=0;Static voidInc () {C++;}}classcount{ Public Static voidprt (String s) {System.out.println (s);} Public Static voidMain
Animal class:Package com.cnblogs;public class Cat extends animal{Default constructor with no parametersPublic Cat () {Super (); must appear in the first row of the construction method. This ();Super ();Super ("XX", 10); The code represents the constructor that invokes the parent class with a parameterSystem.out.println ("Cat Builder"); }/ * public String name;pu
The Super keyword is similar to this, which is used to represent an instance of the current class, and super is used to represent the parent class.Super can be used in subclasses, by Dot (.) To get the member variables and methods of the parent class. Super can also be used in subclass subclasses, where Java can automatically trace back to the upper class.The beh
In Python multiple inheritance, take advantage of super (). The parent class method, you can call all the parent classes, so that in the state of the override, the call to all the parent class again!Cases:Print"****** multiple inheritance using super (). __init__ occurrence state ******")ClassParent(object):Def__init__(Self, name, *args, **kwargs):# to avoid multiple inheritance errors, use variable length
Recently in the internal class, but was "why anonymous internal class or local internal class use method of local variables, local variables must be final type" troubled, when looking for information on the Internet, I found that class initialization completely do not understand, before the understanding is wrong! So looking back at the basic initialization, when looking at the initialization, it was found that "why only the first line of the constructor to write this () or
* Super: Can be used to modify properties, methods, constructors*when a subclass has a property of the same name as the parent class, you can explicitly call the attribute declared in the parent class by the super. This property.* If you want to invoke a property with the same name as the subclass "This property"** *) When a subclass overrides a method of a parent class, it is necessary to use the "
First, this keyword 1, description The This keyword represents the object of the current class and can access the properties, methods, constructors of this classNote: who calls the method, this refers to who2. GrammarAccess properties:this. property name = value;SYSTEM.OUT.PRINTLN (this. Attribute name);Access method:This. Method name ();To access the constructor:This ([parameter list]);3. PrecautionsIn general, if you access the members of the current class internally, you can access it directl
The MRO (Method resolution Order) is used by Python to parse the order of the method calls, and the MRO records the class type sequence of all the base classes of a class, and super does not simply call the method of the base class, but instead invokes the method of the class in the order of the MRO.When super () is used, it should be used in all classes, otherwise there may be cases where the class constru
decorated.Final decorated member variables, the final variable must be assigned, the value of the base reference type cannot be modified, the object that references the execution cannot be modified, but the contents of the object can be modified.Note that classes or methods cannot be abstractor and final decorated at the same time, and Abstractor classes and methods must be extended and rewritten.---------------------------------------------------------------------------------------------------
1 PackageCom.lovo;2 3 Importjava.util.Arrays;4 5 /**6 * Super Array7 * 8 * @authorAdministrator9 * Ten * @param One */ A Public classSuperarray { - Privatet[] array; - Private intsize; the - /** - * Constructors for super arrays - */ + PublicSuperarray () { - This(8); + } A at /** - * Constructors for super arrays -
public class Father {protected String name;int age;Father () {System.out.println ("Father non-parametric constructor");}Father (String name) {SYSTEM.OUT.PRINTLN ("parameter constructor for person");}Public, private, protected, subclass can inherit the public, protectedThe default is to be private, not inherited,Java does not support multiple inheritance, C + + support,Extends: extension, not the meaning of inheritancevoid jump (int lenth) {System.out.println ("lenth =" +lenth);}protected void Ju
WP Super Cache is a good WordPress optimization plugin, is the best I have used a cache plugin. Open the wordpress background Search Plugin page, the first is the plugin, it is conceivable that his status is much more powerful.What is WP Super Cache? WP Super cache generates static HTML files from your dynamic WordPress blog. When an HTML file is generated, your
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.