Mastering C++: A Comprehensive Quiz Based on 'Thinking in C++

Session length

1 / 20

What does the VPTR point to?

VTABLE

The VPTR, or virtual pointer, points to the VTABLE, which contains the addresses of the virtual functions in a class. This allows for runtime polymorphism, where the appropriate version of a virtual function is called based on the type of object it is pointing to. The other options are incorrect because

-B: The VPTR does not point to the derived class, as this would defeat the purpose of dynamic binding.

-C: The VPTR does not point to the base class, as this would not allow for the derived class's specific virtual function implementation to be called.

-D: The VPTR does not point to the virtual functions directly, as this would not allow for dynamic binding and would also take up unnecessary memory.

Get further explanation with Examzify DeepDiveBeta

Derived class

Base class

Virtual functions directly

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy