What is the base class, what is the parent class

Base class is the parent class, the derived class is a subclass

You can be understood as a parent-child relationship in life,

That son inherits all the features of the faces of father, son, but there are some features that are not fathers

Professional point of speaking, is a subclass can inherit and use the properties and methods of the parent class, you can also have their own properties and methods!

So you do not know can not understand?

 

Here again we talked about some of the inherited characteristics:


inherit

Use of inheritance is to reduce redundant code and enhance the scalability of the code.

Relationship :( subclass inherits the parent class is a must in line with the) class subclass name: the name of the parent class

If the parent class has a no-argument constructor, then the subclass will implicitly call the parent class default constructor base no arguments () :,

Otherwise, the display call the parent class constructors base argument (parameter name).

Inherited characteristics

Transfer of: subclass can call the parent class attributes and methods of the parent class and the parent class of all of the above

Single root: a subclass can inherit two or more than two parent

Subclass can have only one parent, but a parent can have multiple children classes, subclasses can have an unlimited number, written as needed, all classes are subclasses of Object. Although sub-class can only inherit a parent class, but can additionally implement multiple interfaces.

Guess you like

Origin www.cnblogs.com/web-record/p/10981309.html