What is late bound function call and early bound function call? Differentiate.

Showing Answers 1 - 1 of 1 Answers

samiksc

  • Jan 19th, 2006
 

All virtual functions have late binding. All non-virtual functions will have early binding.

Early binding happens at compile time. Compiler, looking at the reference or pointer type decides the method to be called.

Late binding happens at runtime looking at the type of object referred by a pointer or reference variable.

For example, suppose base class B and derived class D have implemented a method F().

B *ptr = new D;

ptr->F();

If F() is virtual then D's implementation will be called.

If F() is not virtal then B's implementation will be called.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions