The Python language has similar class inheritance to C + +, and in the class definition, Python customizes the first self, similar to the this pointer in C + +, pointing to the object itself.
Examples of Python simple classes:
>>> class Hello (object):
... Def print_c ():
. print "Hello world!"
>>> hello (). Print_c ()
Hello world!
Of course, in practice, the inevitable need for class inheritance, subclass inherits the parent class, normal as follows:
>>> class Child (Hell
This article is for the Super Dog, and the toolkit version of the Super Dog Kit is 2.4 version. The Super Dog pictures are as follows:It consists of two dogs, one is a super dog and the other is a development dog, which is required in this blog post. First, install the development suite on the CD.The next step is to de
Unlike Java, super in Ruby replaces not the parent class, but the method with the same name as the current method in the parent class. In Ruby, super is used flexibly. When super is used, without any parameters (and no parentheses), the actual function is to automatically call the current method in the parent class and pass the current parameter over, that isSupe
When partitioning, each partition is a file system, and the block at the beginning of each file system is called a super block. Super blocks are used to store file system size, empty and filled blocks, their respective totals, and other such information. That is to say, when we want to use this partition for data access, the first thing we need to go through is the supe
By defining a method or member with static, it provides some convenience for our programming, which in some way can be said to be similar to global and global variables in the C language. But it's not that you can use it anywhere, and if you do, you need to think about whether you're programming with object-oriented thinking and whether your program is object-oriented.Okay, now we're going to talk about the meaning and usage of the two keywords Thissuper.In Java, this usually refers to the curre
Background
Java given a specific type parameter a after the generic list, with the given another specific type parameter x of the generic list
Super or extends can define a large class of generics as the parent class for generics that give specific type parameters.
Super or extends defines a bounded generic that overrides the hierarchical relationship between the decision and the specific p
Transferred from: http://blog.csdn.net/yihuei123/archive/2007/06/04/1637893.aspxBy defining a method or member with static, it provides some convenience for our programming, which in some way can be said to be similar to global and global variables in the C language. But it's not that you can use it anywhere, and if you do, you need to think about whether you're programming with object-oriented thinking and whether your program is object-oriented.Okay, now we're going to talk about the meaning a
Super in 2012 gradually by the media vigorously propaganda, the current super is not what fresh products, including the front computer software and hardware application network also for everyone recommended a lot of the latest release of the super computer and related super This introduction article, for a lot of frien
Introduction-Recent database system principles of the textbook, there are some small knowledge point to see really let people silly, even if the psychology of me, do not know what it said, yesterday group meeting discussion, everyone's understanding also have different, the primary key, candidate key, super key, foreign key these seemingly very small concept, discussed for a whole half hour. Let me tell you about my understanding.
--------------------
Java Object-oriented-–super keywords
1: Define father (parent Class) class
1: member variable int x=1;2: Construction method without parameter and argument, with output statement
2: Define son class extends Father class
1: member variable int y=1;2: The construction method is non-parametric and has a parameter. have output statement this.y=y+x;
3: Create son class object
Son son=new Son(3); Sy
Like what
class Child (Parent): def __init__ (self): Parent . __init__ (self)
Reply content:For your question, the answer is yes, and there is no difference. But I don't feel good enough to answer the question.
To talk about super, first we should ignore the interference of the name "Super".
don't talk about super when you think of the parent
outercls.innercls ();
}
}
Class outercls{
public static Class innercls{
Innercls () {
System.out.println ("Innercls");
}
}
}
The output will be as you expect.
Innercls
Same as the ordinary class. For other uses of internal classes, refer to the relevant chapters in the "I" Java, which are not detailed here.
Second, this super
In the previous section, we discussed the various uses of static, by defining a method or member with static,
Intel has recently been exerting its power at the channel end, and the computer stores, 3C stores and the manufacturers of the manufacturers have been pushing the pole. However, in the face of "super extreme" this jerky vocabulary, a large number of users do not understand their meaning. Many consumers think "ultra-extreme" means super lightweight and super perfo
When the subclass needs to call the method of the parent class, before python2.2, call the class's method directly with the class name, that is, the non-binding class method, and the self of the object is passed in the argument.
Class A (object): def Say (self): print ' I am A ' class B (a): def Say (self): print ' I am B ' A.say ( Self) B = B () B.say ()
Output
I am BI am A
This works fine, but there is a problem, when the parent class changed the name, it is necessary to
Think of Python's super () function, pythonsuper
Python-super
Thought of by the super () function of Python
First, let's take a look.super()Function Definition:
super([type [,object-or-type]])Return a **proxy object** that delegates method calls to a **parent or sibling** class of type.
ReturnsProxy objectThis object
wrong, hehe.Third, in the function, it is necessary to refer to the current object of the class that the letter belongs to, directly with this. In fact, these usage summary is from the "This is a pointer to the object itself" this sentence of a deeper understanding of the word, rote or easy to forget and easy to make mistakes, to understand! second, Super Super key is similar to this, is a masked member va
Super chain: Super Outside the chain is a collection similar to Alexa ranking query, PR query webmaster commonly used to query the site, because these sites are mostly query record display function, and query records can be Baidu, Google, Sogou and other search engines quickly included, so that the formation of the chain. Because this is the normal query generated outside the chain, so this external chain o
I. Why do I need to call "Super viewdidload"-(void) didreceivememorywarning {
[Super didreceivememorywarning];
}
-(Void) viewdidload {
[Super viewdidload];
}
In the above Code, what do I need to call the corresponding methods of the parent class?
Taking viewdidload as an example, viewdidload in the parent class (Super
Super is used to solve multiple inheritance problems, it is not a problem to call the parent class directly with the class name when using single inheritance, but if multiple inheritance is used, it involves various problems such as lookup order (MRO), repeated invocation (Diamond inheritance). In short, the experience left behind is: to maintain consistency. Either call the parent class with the class name, or use
The role of the super () in python and the definition of object methods in Python are weird. The first parameter is generally named self (equivalent to this in other languages), which is used to pass the object itself, when a call is made, it does not need to be explicitly transmitted, and the system will automatically pass it.
The main character we introduced today is super (). in the inheritance of class
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.