Decorators provide a flexible alternative to subclassing for extending functionality.
Problem You want to add behavior or state to individual objects at run-time. Inheritance is not feasible because it is static and applies to an entire class. Discussion Suppose you have a user interface toolkit and you wish to make a border or scrolling feature available to clients without defining new subclasses of all existing classes. Both the decorator objects and the core object inherit from this abstract interface. Note that this pattern allows responsibilities to be added to an object, not methods to an object's interface.