Java polymorphism

Time:2020-5-18

It can be understood as a variety of forms of things.

The manifestation of polymorphism:

A reference to a parent class points to its own child class object.

A reference to a parent class can also receive its own child class object. 

The premise of polymorphism:

It must be a relationship between classes, either inheritance or implementation.

There is also a premise: there is coverage

Benefits of polymorphism:

Greatly improved the scalability of the program

Disadvantages of polymorphism:

Improved extensibility, but only the reference of the parent class can be used to access members in the parent class.