Intermediate Object-Oriented Programming Concepts
Q43 / 100

Why might a class be designed to favor composition over inheritance?

Correct! Well done.

Incorrect.

The correct answer is B) Composition offers more flexibility, avoids tight coupling to a rigid hierarchy, and allows behavior to change at runtime

B

Correct Answer

Composition offers more flexibility, avoids tight coupling to a rigid hierarchy, and allows behavior to change at runtime

Explanation

"Favor composition over inheritance" is a design principle because deep inheritance hierarchies can become fragile and hard to change, whereas composed objects can be swapped independently.

Progress
43/100