Application introduction of inheritance based on Java subclass
1. Definition of inheritance
Some of the members of a subclass are declared and defined by the subclass itself, and the other is inherited from its parent class. Subclasses inherit the member variables of the parent class as their own member variables, as if they were directly in the subclass
Like declarations, it can be manipulated by any of its own instance methods in a subclass. In other words, the inherited member of a subclass should be the full member of the class. If the instance method declared in the subclass cannot operate on the parent class
For a member variable of the subclass, the member variable is not inherited by the subclass. The subclass inherits the methods of the parent class as the methods in the subclass. Just as they are directly declared in the subclass, they can be declared by the blade tiger instance in the subclass
Method call.
2. The child and parent classes are in a package
Subclasses can inherit member variables and methods other than private in the parent class as their own member variables and methods. The access rights of inherited member variables and methods are unchanged.
/test/src/com/b510/Parent. java