Origin: | Grand 98 | |||||||||
Reason: | An object needes to be different subclasses at different times. | |||||||||
Synopsis: | Extend a class C by writing an additional class D with added funtionality that uses instances of C. | |||||||||
Example: | An airline reservation system has roles such as flight crew, passenger, ticket agent,etc. A person can play different roles at different times, and more than one role at a time. Inheritance makes this impossible. | |||||||||
Solution: |
|
|||||||||
See also: |
Bridge Decorator Facade Proxy State Strategy |