Significance of polymorphism in object-oriented as well as benefits

Concept of polymorphism: the same behavior, different implementations


 

What is a static polymorphism? What is the dynamic polymorphism?

Static polymorphism : When compiling the results have been identified, such as overloading and rewrite

Dynamic polymorphism : determining when it is run,


 

Dynamic polymorphism is dependent on what technology to achieve?

  1. inherit
  2. Rewrite
  3. Upward transition (parent class object reference to point to a child

 

What are the benefits of multi-state dynamic that?

Reduce coupling of the code, the latter needs to be modified only when the need to add content without modifying the code has been defined previously.


Extensible knowledge:

  1. Reference can also point to an object interface implementation class;
  2. Generating reflection dynamic objects;
  3. Spring IOC injection complete;
  4. Bridge mode, the decorator pattern, strategy pattern and other common design patterns;
  5. Polymerizable composition principle, rely on the principle of reverse common design principles.

 

 

Guess you like

Origin www.cnblogs.com/liqking/p/11964523.html