Changes

Jump to: navigation, search

Decorator

670 bytes added, 16:52, 26 February 2007
Introduction
==Introduction==
* Decorator, a [http://en.wikipedia.org/wiki/Structural_pattern structual pattern] also known as wrapper(acts as an interface between its caller and the wrapped code), adds additional functionality to a class at runtime through composition. Decorators are alternative to subclassing which add behaviour at compile time. By wrapping, it allows us to add things to the component without requireing every subclass to inherit these new qualities. Each decorator wraps a component, which means the decorator has an instance variable that holds a reference to a component.  where subclassing would result in an exponential rise of new classes.* aka Wrapper
* allows us to add things to a component without requiring every subclass to inherit these new qualities.
* Function added at runtime through composition.
* We want an object to do something new, not its class
* "Classes should be open for extension, but closed for modification
==Motivation==
1
edit

Navigation menu