table of Contents
1. Polymorphic formula-three definitions and two methods
1. Polymorphic formula-three definitions and two methods
Three definitions
- The parent class defines the subclass construction;
- Interface definition implementation class construction;
- The abstract class defines the construction of the entity class.
Two methods
- Method overloading;
- Method rewriting.
2, specific content
Method overloading: overloading methods in a class. The method name is the same, the parameters are different, and the function is different.
Method rewriting: The subclass rewrites the parent method and the method body. The method name and parameters are the same. The function is different.