Decorator
Usage
- Also known as: Wrapper
- Add responsibilities to objects dynamically
- Attach additional responsibilities to an object dynamically
- Provide a flexible alternative to subclassing for extending functionality
Diagram
Participants
Component
ConcreteComponent
- Defines the interface for objects that can have responsibilities added to them dynamically.
Decorator
- Defines an object to which additional responsibilities can be attached.
ConcreteDecorator
- Maintains a reference to a Component object and defines an interface that conforms to Component's interface.
- Adds responsibilities to the component.
Resources URL:
notes/design_patterns/resources
Sources URL:
notes/design_patterns/sources
