How the execution speed improve through the run time polymorphism.

Showing Answers 1 - 1 of 1 Answers

Radha Krishna

  • Aug 1st, 2011
 

VTable is a list of VPTRs i.e. Virtual Pointers, which are the function pointers for the all of the functions for the class. These Pointers help in runtime / virtual binding of the function with objects. Every time a class, having virtual function, is inherited, the inheriting class gets its own VTable. And every virtual function, which is overridden in derived class, gets its FP replaced by FP of Overridden function. Hence at runtime, when an object has to decide which implementation of the function has to be called, the VTBL is looked into, and according to Object (Not the Type / Class), the function is 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