Advanced
Object-Oriented Programming Concepts
Q99 / 100
What is the relationship between the "Composite" design pattern and polymorphism?
Correct! Well done.
Incorrect.
The correct answer is A) Composite lets individual objects and compositions of objects be treated uniformly through a shared interface, relying on polymorphism so client code does not need to distinguish leaves from containers
A
Correct Answer
Composite lets individual objects and compositions of objects be treated uniformly through a shared interface, relying on polymorphism so client code does not need to distinguish leaves from containers
Explanation
In Composite, both "leaf" and "composite" (container) nodes implement a common component interface, so client code can call the same methods on either without type checks — a direct application of polymorphism.
Progress
99/100