Connecting a method call to the method body is known as binding.
- There are two types of binding:
- -static binding (also known as early binding).
- -dynamic binding (also known as late binding).
- Static binding in occurs during compile time while dynamic binding occurs during runtime.
private
,final
andstatic
methods and variables use static binding and are bonded by compiler while virtual methods are bonded during runtime based upon runtime object.- Static binding uses
Type
(class
in Java) information for binding while dynamic binding uses object to resolve binding. - Overloaded methods are bonded using static binding while overridden methods are bonded using dynamic binding at runtime.
Comments
Post a Comment