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.


Why might the Smalltalk solution for containers be problematic in C++?

  1. C++ does not have inheritance

  2. C++ allows multiple inheritance, allowing for separate class hierarchies

  3. C++ containers cannot hold pointers to objects

  4. C++ does not support object-oriented programming

The correct answer is: C++ allows multiple inheritance, allowing for separate class hierarchies

In C++, multiple inheritance allows for a class to inherit from two or more base classes, whereas in Smalltalk, classes can only have one superclass. As a result, in C++, container classes may have separate class hierarchies, making it difficult to determine how data should be stored and accessed within the containers. This is why the Smalltalk solution may be problematic in C++. The other options are incorrect as they do not address the difference in inheritance and multiple class hierarchies between Smalltalk and C++.