C++ Virtual Functions Question:
Download Questions PDF

What is Virtual Table?


A virtual table is a mechanism to perform dynamic polymorphism i.e., run time binging. Virtual table is used to resolve the function calls at runtime. Every class that uses virtual functions is provided with its own virtual functions.

Every entry in the virtual table is a pointer that points to the derived function that is accessible by that class. A hidden pointer is added by a compiler to the base class which in turn calls *_vptr which is automatically set when an instance of the class is created and it points to the virtual table for that class..

Download C++ Virtual Functions Interview Questions And Answers PDF

Previous QuestionNext Question
What is virtual function?Can you please explain the difference between Overloading and Overriding?