The fifth study concluded java

Transformation [1] object
parent class reference point to a subclass object, we call this process upward transition, are automatic type conversion. After the transition up the parent class reference variables can only be called its compile-time type of method, it can not be called runtime type of method. In this case, we need to cast type, we call downcast!
[2] appreciated polymorphic
polymorphism points:

  1. Polymorphism Polymorphism is the method, not a property of polymorphism (polymorphism unrelated attribute).
  2. The presence of polymorphism have three necessary conditions: inherited, override methods, references to the parent class subclasses the object.
  3. After the parent class reference to sub-class object, method calls with reference to a subclass overrides the superclass, then multi-state arises.
Released nine original articles · won praise 0 · Views 43

Guess you like

Origin blog.csdn.net/justzg/article/details/104517070