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 happens to the VPTR during object construction?

  1. It is destroyed

  2. It points to the base class's VTABLE

  3. It is initialized to point to the appropriate VTABLE

  4. It remains uninitialized

The correct answer is: It is initialized to point to the appropriate VTABLE

During object construction, the VPTR is initialized to point to the appropriate VTABLE. This option is correct because the VPTR must be set to the VTABLE of the specific class being constructed in order for the appropriate virtual function to be called. Option A is incorrect because the VPTR is not destroyed during object construction. Option B is incorrect because the VPTR does not point to the base class's VTABLE, but rather the VTABLE of the specific class being constructed. Option D is incorrect because the VPTR must be initialized during object construction in order for virtual functions to function correctly.