Skip to content
Sharp

Design patterns · interview question

Which structural element does a Decorator class typically contains?

Multiple choiceEasychapter-13-curatedpremiumdesign-patternsdecorator-pattern
Choose one answer
Answer and explanation

Correct answer

D. A reference to the component it wraps

Why

A Decorator class typically contains a reference to the component it wraps, allowing it to add functionality while still delegating calls to the original component.

Test yourself on Design patterns

A free test with instant, explained results. No account needed.

Start free test
All Design patterns questions →