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.


What describes the relationship between 'Brass' and 'Wind' in the example?

  1. Aggregation

  2. Composition

  3. Inheritance

  4. Association

The correct answer is: Inheritance

In this particular example, 'Brass' is a type of 'Wind' instrument. This is an example of inheritance, as 'Brass' inherits traits and functions from the general category of 'Wind'. Aggregation would refer to a relationship where an object contains other objects as a part, and composition would refer to a relationship where an object is composed of other objects as its components. Association refers to a looser relationship between two objects, without implying any sort of hierarchical structure. Therefore, none of these options accurately describe the relationship between 'Brass' and 'Wind' in this example besides C Inheritance.