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

Disable ads (and more) with a membership for a one time $2.99 payment

Test your C++ skills with our quiz based on Bruce Eckel's 'Thinking in C++'. Dive into object-oriented programming, advanced topics, and fundamentals. Perfect for learners and experts alike. Assess your knowledge and become a C++ master!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What does the VPTR point to?

  1. VTABLE

  2. Derived class

  3. Base class

  4. Virtual functions directly

The correct answer is: 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.