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 if a class is derived from another class with virtual functions but does not override them?

  1. It gets removed

  2. It points to the base class's VTABLE

  3. It is reset at runtime

  4. It points to its own VTABLE

The correct answer is: It points to the base class's VTABLE

If a class is derived from another class with virtual functions but does not override them, the VPTR will still exist. It will point to the base class's VTABLE because the derived class inherits the virtual functions from the base class. Option A is incorrect because the VPTR is a crucial part of polymorphism and cannot be removed. Option C is incorrect because the VPTR stays the same at runtime. Option D is incorrect because the derived class does not have its own VTABLE, it shares it with the base class.