About polymorphic mechanisms in Java
Http://www.cnblogs.com/chenssy/p/3372798.html
This blog post is very thorough.
Basically, it means
Polymorphic Definitions:
Polymorphism refers to the specific type of reference variable defined in the program and the method call issued by the reference variable is not determined during programming, but is determined during the program's run, that is, a reference to which the variable bottom will point to which class the instance object, the reference variable emitted by the method call is exactly the method implemented in the class. Must be determined by the time the program is running. Because when the program is run to determine the specific class, so that, without modifying the source code, you can bind the reference variable to a variety of different class implementations, resulting in the invocation of the specific method of the reference change, that is, do not modify the program code can be changed when the program runs the specific code, so that the program can select multiple running state, This is polymorphism.
There are three prerequisites for implementing polymorphism in Java: inheritance, rewriting, and upward transformation:
Inheritance: Subclasses and parent classes that have inheritance relationships must exist in polymorphism.
Rewrite: Subclasses redefine some methods in the parent class and call the methods of the subclasses when they are called.
Upward transformation: In polymorphic, a reference to a subclass needs to be assigned to the parent class object, so that the reference can have the ability to invoke methods and subclasses of the parent class.
Polymorphic Mechanisms:
When a Superclass object reference variable refers to a subclass object, the type of the referenced object rather than the type of the reference variable determines which member method to call, but the method that is called must be defined in the superclass, that is, the method covered by the quilt class.
In fact, the invocation of an object method in the inheritance chain has a priority: This.show (O), Super.show (O), This.show ((Super) O), Super.show ((Super) O).
Java overrides and overloads are defined in C + +, but behave differently in inheritance
Java is overridden in inheritance:
http://blog.csdn.net/fly_zxy/article/details/45622069
Java is overloaded in inheritance:
Http://www.cnblogs.com/kuillldan/p/5905572.html
Overriding overloads in Java polymorphism mechanisms and inheritance