Skip to content
Sharp

Design patterns · interview question

What principle does the Decorator pattern adhere to by allowing the dynamic addition of responsibilities to objects?

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

Correct answer

D. Open/Closed Principle

Why

The Decorator pattern supports the Open/Closed Principle by enabling objects to be extended with new behaviors without modifying their existing code.

Test yourself on Design patterns

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

Start free test
All Design patterns questions →