Intent
Attach additional responsibilities to an object dynamically.
Attach additional responsibilities to an object dynamically.
Why is this used?
Decorators provide a flexible alternative to sub-classing for extending functionality.
Decorators provide a flexible alternative to sub-classing for extending functionality.
UML diagram representation
https://www.tutorialspoint.com/design_pattern/images/decorator_pattern_uml_diagram.jpg
https://www.tutorialspoint.com/design_pattern/images/decorator_pattern_uml_diagram.jpg
Source code example
https://www.tutorialspoint.com/design_pattern/decorator_pattern.htm
More to follow...
No comments:
Post a Comment