Polymorphic:
Concept of polymorphism: a thing of various forms; allowing objects of different classes respond differently to the same message
Polymorphic premise: inheritance, rewriting; upcast (parent class to sub-class object reference)
Polymorphic role: to improve the availability of the code; reduce the coupling between modules
Polymorphic Category:
Compile-time polymorphism: method overloading design
Run-time polymorphism: Which method is called dynamic run-time decision-making process
Downcast and upcast
Upward transition: a reference point to the parent class instance of a subclass, the subclass can call parent class derived rewritten unique subclass method can not be called
Note: The parent class static methods can not be overridden by subclasses, so after the transition up to the parent class can only call the original static method
Syntax: Pet snoopy = new Dog ();
Downcast: sub-class reference point to the parent class object, here must be strong turn, subclass-specific methods can be called up;
Restructuring conditions must be met in order to be downcast
Syntax: Dog snoopy = (Dog) mybabay;
instanceof operator: determining whether the object is on the left and the right instance of the class, the return value is a Boolean type
Analyzing objects can be left to the right have the object type characteristics or whether the right is produced by a class is instantiated
Class method (static method) can only be inherited by subclasses use can not be overwritten; final, static properties modified
Abstract class