The decorator design pattern allows us to assign responsibilities to an object without impacting the class. Without the decorator design pattern, we can assign responsibilities to objects through inheritance. A more streamlined approach is to use the decorator design pattern to assign additional responsibilities to specific objects. The key goal is to add the additional responsibility to objects dynamically and without impacting other objects.
This design pattern is commonly used with graphical software that includes layering objects over one another. For example, building a Graphical User Interface (GUI) or creating a Heads Up Display (HUD) for a game.
The decorator design pattern is occasionally referred to as a wrapper design pattern because the decorator essential wraps around the object and its dynamically created responsibilities...