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!

Practice this question and more.


In what scenario can constructors of subobjects be explicitly called?

  1. Destructor

  2. Member function

  3. Constructor initializer list

  4. Overloading function

The correct answer is: Constructor initializer list

Constructors of subobjects can only be explicitly called in the initialization list of another constructor. This is because constructors of base classes or member objects are automatically called when a constructor is invoked. Calling the constructor of a subobject in any other scenario would result in an error or unexpected behavior. The other options do not relate to constructors of subobjects and are incorrect.