0

What is the difference b/w static binding and member function overriding?

I've read that in function overriding, derive class function overrides base class's ..where as in static binding,base class function is called even if we point to derive class..Why does 2 statements contradict?What exactly is the difference?

29th Dec 2018, 1:45 PM
Maleeha Khalid
Maleeha Khalid  - avatar
1 Resposta
+ 9
In dynamic binding, derived class's function overrides the base class's function. Just like you said. But in static binding, If a function is final, private or static in a base class, that function can't be overridden by the derived class. Now when overriding doesn't occur, the function in the base class is called. In short: In dynamic binding, type of object is determined. In static binding, type of reference is determined. For more explanation visit this link: https://beginnersbook.com/2013/04/java-static-dynamic-binding/
29th Dec 2018, 3:32 PM
blACk sh4d0w
blACk sh4d0w - avatar