Design Patterns - Decorator

Attach additional responsibilities to an object dynamically by adding other objects to it. Provides a flexible alternative to extend functionality to class hierarchies and inheritance.

An object has a list of decorators to add extra responsibilities, and when called, uses the added objects to add the extended stuff. For example, a decorator could be an object that adds a border to other one, so you could create a bordered window by adding the decorator to the window object.

Notes References

20210408132546 Computer Science - Design patterns

References