Your example is dynamic binding,
because at run time it is determined what the type of
a is, and the appropriate
method is called
·
IT IS Also called late binding
·
When compiler is not able to resolve the
call/binding at compile time, such binding is known as Dynamic or late binding.
Overriding is a perfect example of dynamic binding as in overriding both parent
and child classes have same method. Thus while calling the overridden method,
the compiler gets confused between parent and child class method (since both
the methods have same name).
·
Overriding is the example of dynamic binding
·
Static binding is are the example of overloading
No comments:
Post a Comment