1. Benefits of Inheritance:
1. Improve code reusability.
2. Create a relationship between classes and classes, providing a precondition for the third-largest feature polymorphism of the object-oriented
Single inheritance is supported in 2.java, and multiple inheritance is not directly supported, but multiple inheritance in C + + is improved. Java is solved by multiple implementations, and a class can implement multiple interfaces.
Single inheritance: A subclass can have only one direct parent class.
Multiple inheritance: A subclass can have multiple direct parent classes that are not allowed in Java, but are modified. Because multiple parent classes have a member with the same name, multiple inheritance produces the uncertainty of the call.
3. When the member and local variables of this class have duplicate names, use this. Distinguish
Use Super when the members of the subclass and the members of the parent class have the same name. Distinguish
This represents a reference to a class object, and super represents the parent class space.
java-Object-oriented 2--inheritance, polymorphic