Distinguish, differentiate, compare and explain what is the main difference between static and dynamic binding. Comparison and Differences.
Difference between static and dynamic binding
1. Static binding happens at compile time. Dynamic binding happens at run-time.
2. The actual object is not used for static binding. The actual object is used for dynamic binding.
3. Static binding is also called early binding because binding happens during compilation. Dynamic binding is also called late binding because binding happens at run-time.
4. The best example of a static binding is method overloading. The best example of a dynamic binding is method overriding.
5. Private, static and final methods show static binding because they cannot be overridden. Other than private, static and final methods show dynamic binding because they can be overridden.