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 does composition in OOP refer to?

  1. Creating new classes from existing ones using inheritance

  2. Embedding objects of other classes inside a new class

  3. Overloading functions within a single class

  4. Designing interfaces for classes

The correct answer is: Embedding objects of other classes inside a new class

Object-oriented programming (OOP) utilizes the concept of composition, which refers to the ability to embed objects of other classes within a new class. This allows for greater flexibility in class design and functionality. Option A, creating new classes from existing ones using inheritance, is known as inheritance and is a related concept, but is not the same as composition. Option C, overloading functions within a single class, and option D, designing interfaces for classes, are not directly related to composition in OOP.