According to Gang of Four, the Decorator pattern's intent is to
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.[1]
[1] Gamma, E., Helm, R., Johnson, R., Vlissides, J., Design Patterns: Elements of Reusable Object-Oriented Software, Reading, Mass.: Addison-Wesley, 1995, p. 315.
The Decorator pattern works by allowing me to create a chain of objects that starts with the decorator objects—the objects responsible for the new function—and ends with the original object. Figure 15-3 illustrates this.
The class diagram of the Decorator pattern in Figure 15-4 implies the chain of objects shown in Figure 15-3. Each chain starts with a Component (a ConcreteComponent or a Decorator). Each Decorator is followed either by another Decorator or by the original ConcreteComponent. A ConcreteComponent always ends the chain.
For example, in Figure 15-4, ConcreteDecoratorB performs its Operation and then calls the Operation method in Decorator. This calls ConcreteDecoratorB's trailing Component's Operation.