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?
- inherit
- Rewrite
- 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:
- Reference can also point to an object interface implementation class;
- Generating reflection dynamic objects;
- Spring IOC injection complete;
- Bridge mode, the decorator pattern, strategy pattern and other common design patterns;
- Polymerizable composition principle, rely on the principle of reverse common design principles.