Class A:def __init__ (self):Print "Enter A"Print "Leave A"Class B (A):def __init__ (self):Print "Enter B"a.__init__ (self) # old methodPrint "Leave B">>> B = B ()Enter BEnter ALeave ALeave BThe disadvantage of this is that when the parent class of a subclass changes (such as when the parent class of Class B changes from A to C), the entire class definition must be traversed, replacing all the class names of the unbound methods.Since Python 2.2, Python has added a keyword
Python super
I. Problem Discovery and Proposal
In the method of a Python class, to call a method of the parent class, before Python 2.2, the usual method is as follows:
Code Segment 1:
Class:Def _ init _ (self ):Print "enter"Print "leave"
Class B ():Def _ init _ (self ):Print "enter B"A. _ init _ (self)Print "leave B"
>>> B = B ()
Enter BEnterLeaveLeave B
That is, use non-bound class methods (Methods referenced by class names), and introduce the objec
Today met a demand, customer registration page customized a super long registration notice, a lot of content. But the style is relatively nice to do.The content of the registration notice is made using multiple message stitching.Boss said Rawtext support HTML style, so I think of three solutions:1. Put the messagetextinput inside the messagecompaonentlayout, and then disabled it out, Messagecompaonentlayout set the width to 80%.2. Put Messagestyledtex
How can I design a super administrator with user permissions? When developing a member management system, you want to have the permissions of a super administrator to perform any operations without knowing how to distinguish it from other users. now you want to make the program accessible by default as a super administrator, then other users can judge based on th
Source: http://zhangjunhd.blog.51cto.com/113473/20531/1. What is super? What is this? the Super keyword denotes the meaning of the super (parent) class. The This variable represents the object itself. 2. call the constructor using superthis classperson { Public Static voidPRT (String s) {System. out. println (s); } person () {PRT("A person."); } person (String
Super has the following two major functions:1. Qualifying : force access to members of the parent class (Field, method)2. Call function : Specify/Display a constructor that invokes the parent classSuper Call rule:1, the subclass constructor will always call the parent class constructor once , by default, the class constructor automatically calls the parent class without parameters of the constructor ;2, if you want to explicitly specify which construc
Xrange Module
Use range uniformly, and add__contains__
Raising exceptions/handling Exceptions
Raise and AS Keywords
Next () function
Keep only next() , .next() throw property exceptions
For loop
forLoop variables no longer cause namespace leaks
Compare non-sortable types
Python does not support different types of comparisons
Enter input
Only input is allowed and Raw_input is c
In China 3G on the eve of the horse, mobile im seems to be the most popular mobile value-added services, may be due to see the success of Tencent it. In the second half of 2006, China Mobile launched a flying letter business, and before this, to Pica-led mobile IM software also swept the domestic mobile phone users. Today, China Unicom also launched its own mobile IM Software-Super letter. China Unicom's friends must be very concerned about it, this i
Python 2.2, Python has added a keyword "super" to solve this problem. The official documentation for python 2.3 is as follows:
Super (type [, object-or-type])
Return the superclass of type. If the second argument is omitted the super objectReturned is unbound. If the second argument is an object, isinstance (OBJ, type)Must be true. If the second argument is a ty
The super function is used to solve diamond inheritance.First, the inheritance of Python and the invocation of the parent class memberParent class:class Base (object): def __init__ (self): print ("base init". ")Normal method calls the parent class:class Leaf (Base): def __init__ (self): base.__init__ (self) print ("Leaf init. ")The Super method calls the parent class:class Leaf (B
Java basics-super and this parsing, extends uper
1. The super keyword indicates the meaning of the super (parent) class. This variable represents the object itself.
2. super accesses hidden variables or override methods of the parent quilt class. If the current class is inherited from the superclass, when
PHP super global variables summary, php global variablesSummary of important PHP super global variables in silicon1985
PHP has nine predefined variable arrays, which are summarized as follows:
1. $ _ SERVER
The $ _ SERVER super global variable contains information created by the web SERVER. It provides information about the SERVER and the customer configuration
First, let's give a question. What is the output result of the following program?
Java codeImport java. util. Date;Public class Test extends Date {Public static void main (String [] args ){New Test (). test ();}Public void test (){System. out. println (super. getClass (). getName ());}}
Import java. util. Date;Public class Test extends Date {Public static void main (String [] args ){New Test (). test ();}Public void test (){System. out. println (
2006: [NOI2010] Super piano time
limit:20 Sec Memory limit:552 MBsubmit:2222 solved:1082[Submit] [Status] [Discuss]
DescriptionSmall Z is a small famous pianist, recently Dr. C gave a small z a super piano, small z hope to use this piano to create the world's most beautiful music. The super piano can play n notes, numbered 1 to N. The magic of the I note
This is the "writer programmer" of the Super Table team, Kai the creation of the super form from the perspective of the team members. "Miss Chen" is the name of the team founder.Flurried Suddenly, time has come from the end of the world 2015 years. It feels lucky not to be the last human being. With teacher Chen come out together for super form fronts, from Beiji
Java Tour (vi)--single case design pattern, inheritance extends, aggregation relationship, child parent class variable relationship, Super, overlay
Java also more and more deep, everyone refueling it! Let's take a step
I. Single-CASE design mode
What is design mode?
There are 23 design patterns in Java, the most effective way to solve a problem
Single Case design mode
Resolves a class that only
Python's method of calling the parent class can be implemented in two ways: by calling the parent class construction method, or by using the Super function (do not mix them).The Code "super (Foochild,self). __init__ (xxx,xxx)" often appears when using "super". So how does super () __init__ () really work?To facilitate
------------- - Zpoor in 0 the Mans the - About the the the */Don't Panic (cool analysis):One, call another construction method through this, the This (argument list), only in the constructor, not elsewhere, and to be placed in the first row of the construction methodIn the case of the parameter of the method or the name of the local variable and member variable in the method, the member variable is masked and the member variable is referenced by the this. Member variable. If you don't have
The Super 3GP Converter is a powerful and easy-to-use 3GP video conversion software that converts almost all audio and video formats to the 3GP format supported by mobile phones. With super 3GP converters and no computers, you can watch movies and videos in all formats on your phone anytime, anywhere!
1, first download and install the Super 3GP Converter
2, dou
When initializing a subclass, the constructor of the parent class must run
Because there is an implicit statement super () in the first row of the constructor of the subclass, all constructors of the subclass default to the first row of super ();
Subclass calls the parent class constructor Super (parameter), the subclass calls the parent class general method:
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.