Java programming ideology note (4) -- polymorphism and programming ideology Polymorphism
1. What is polymorphism?
Polymorphism is a java mechanism called dynamic binding, or later binding and runtime binding. The polymorphism mechanism depends on java inheritance. Inheritance allows the object to be treated as its own type or its base type. A multi-state method call allows one type to show the difference from other similar types, as long as they are derived from the same base class. This difference is presented based on different methods and behaviors.
2. The role of Polymorphism
Polymorphism is used to eliminate coupling between types.
3. What is binding?
Associating a method call with a method subject is called binding.
Pre-binding is called pre-binding before the program is executed, and post-binding is called binding according to the object type during runtime.
4. java Dynamic binding Defects
In java, all methods except the static and final methods are later bound.
Only common methods are called and can be dynamically bound. Both the domain and static methods are bound at the early stage of compilation.