extends inheritance
Inheritance is a prerequisite for polymorphic, if not inherited no polymorphism.
* Extraction is the common inheritance
Parent (base class, super tired) subclass (derived class)
Features: subclass can have a parent class "content" subclasses can have their own "content"
Regular access member methods
1 to create an object is first with whoever who, without looking up
The method returns the value 2 subclasses of the parent class must be less than equal to the return value of the parent
Object is the parent of all classes
3 subclass method permissions must be greater than or equal superclass method permissions
public>protected>(default)留空>private
Inheritance in the constructor
Constructor sub-class which has a default implicit "super ()" call. They must first implementation of the parent class constructor
2 subclass must call the parent class method with the super keyword
3super when you call must be the first statement, the subclass constructor does not call super times
4 subclasses access to the parent object super. Object Name
Subclasses access inherited methods super. The name of the parent class method
Subclasses access Super parent constructor ();
super and this can not be used
Abstract method
Uncertainty in the parent class implemented method body
Abstract methods must be written in an abstract class
public abstract class
public class abstract01 extends abstract1{ @Override public void eat() { } }
Inheritance is a prerequisite for polymorphic, if not inherited no polymorphism.
* Extraction is the common inheritance
Parent (base class, super tired) subclass (derived class)
Features: subclass can have a parent class "content" subclasses can have their own "content"
Regular access member methods
1 to create an object is first with whoever who, without looking up
The method returns the value 2 subclasses of the parent class must be less than equal to the return value of the parent
Object is the parent of all classes
3 subclass method permissions must be greater than or equal superclass method permissions
public>protected>(default)留空>private
Inheritance in the constructor
Constructor sub-class which has a default implicit "super ()" call. They must first implementation of the parent class constructor
2 subclass must call the parent class method with the super keyword
3super when you call must be the first statement, the subclass constructor does not call super times
4 subclasses access to the parent object super. Object Name
Subclasses access inherited methods super. The name of the parent class method
Subclasses access Super parent constructor ();
super and this can not be used
Abstract method
Uncertainty in the parent class implemented method body
Abstract methods must be written in an abstract class
public abstract class
public class abstract01 extends abstract1{ @Override public void eat() { } }