First page Back Continue Last page Graphics
Decorator design
Example
- Take a DarkRoast object
- Decorate it with a Mocha object
- Decorate it with a Whip object
- Call the cost() method and rely on delegation to add on the condiment cost
Decorator adds its own behavior before or after calling the decorated object