Intent
Attach additional responsibilities or functions to an object dynamically or statically. Also known as Wrapper.
Where to use & benefits
- Provide an alternative to subclassing.
- Add new function to an object without affecting other objects.
- Make a responsibility easily added and removed dynamically.
Structure

Participants
Component (IShape)
It defines the interface for objects which having responsibilities to added dynamically.
ConcreteComponent (RectangleShape, CircleShape, TriangleShape)
defines an object to which additional responsibilities can be attached.
Decorator (ShapeDecorator)
It maintains a reference to a Component object and defines an interface that conforms to Component's interface.
ConcreteDecorator (ColorDecorator)
It adds responsibilities to the component.
Example
In the demonstration application, ColorDecorator class decorates the shape (Rectangle, Trinagle, Circle) objects with the user selected color.
Class Diagram
