One.
The third characteristic of an object-oriented polymorphic. How to understand polymorphism, is a variety of forms.
Have seen too many states before, and as far as functions are concerned, it is characteristic of polymorphism. For example, its parameter list is different, its form of existence is not the same. The same function, some in the parent class, some in the subclass, this is not the same. This is the polymorphism of the function. → If that means talking about polymorphism, there may be many aspects involved.
Focus on the polymorphism of the object. First of all, I'm not very clear about the definition of object, is the class an object ? An object created from a class must be an object.
This class object is created and referenced by this class to the object of this class.
Cats have a different form, either a cat or an animal. The object of a new cat () can have many forms. This is the polymorphism of the object.
This sentence, the animal x=new cat (); To parse, the animal is the parent class, creating the variable x, pointing to the subclass object. This is the manifestation of polymorphism. The left side of this sentence is animal, the right cat is the cat class.
Here's the reference, which means x.
Java-Preliminary Understanding-tenth-polymorphism-Overview