polymorphic

1. Polymorphic definition:

  1.There must be an inheritance relationship.

  2.There must be a way to rewrite.

  3.The parent class refers to a subclass object.

Two, the characteristics of member access in polymorphism (parent f = new child).

  A:Member variables: compile the left side, run to the left;

  B:Constructor: When creating subclass objects, access the constructor of the parent class and initialize the data of the parent class.

  C:Member method: compile the left side, run to the right.

  D:Static method: compile the left side, run to the left.

Three. The role of polymorphism.

  1.Improved code maintainability.

  2.Too high the scalability of the code.

Leave a Reply

Your email address will not be published. Required fields are marked *