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

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

Study for the C++ exam based on 'Thinking in C++'. Engage with challenging quiz questions designed to boost your understanding and proficiency in C++. Get prepared to master C++ programming concepts through an interactive and informative quiz experience!

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 determines the size difference between objects with and without virtual functions?

  1. The number of functions

  2. The size of the VTABLE

  3. The inclusion of a VPTR

  4. The amount of data members

The correct answer is: The inclusion of a VPTR

The size of objects with virtual functions is determined by the inclusion of a VPTR (Virtual Pointer), which is a pointer to the virtual table (VTABLE) that is created by the compiler for classes with at least one virtual function. The VTABLE itself is not responsible for the size difference, as it exists regardless of the presence of virtual functions. Similarly, the number of functions or data members do not directly affect the size difference.