CPP MCQ
What is vptr in C++?
A)
A hidden pointer in a class that points to virtual functions of that class
B)
A hidden pointer in a class that points to a virtual table of that class
C)
A pointer in a class that points to other class
D)
A hidden pointer in a class that points to virtual members of the class of that class

Correct Answer : Option (B) :   A hidden pointer in a class that points to a virtual table of that class

Explanation : This vtable pointer or _vptr, is a hidden pointer added by the compiler to the base class and this pointer is pointing to the virtual table of that particular class. This _vptr is inherited to all the derived classes. Each object of a class with virtual functions transparently stores this _vptr.