Vtable Entries

What are the entries of vtable? Which function execute fast virtual function or normal function?

Questions by rdurgalakshmi   answers by rdurgalakshmi

Showing Answers 1 - 1 of 1 Answers

VTable Entries: 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.Everytime 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.Which is faster among VF & Normal Function, I am not sure about.

  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