🎴 Flashcard Mode

Design Patterns - J2EE and GoF Patterns

Card1 / 15
Mastered0
Review0
QuestionClick to flip

What is a Decorator pattern?

AnswerClick to flip back
A
One class takes in another class, both of which extend the same abstract class, and adds functionality.
💡 Explanation:

The Decorator pattern attaches additional responsibilities to an object dynamically. It wraps a component (both implement the same interface) to add behavior without modifying the original class. Option A describes Bridge pattern (decoupling abstraction from implementation), Option C describes Composite pattern (tree structures of objects), and Option D describes Facade pattern (simplified interface to a complex subsystem).

Change Mode