Skip to content

Files

Latest commit

 

History

History

decorator

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Decorator

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. The pattern has structural purpose and applies to objects.

When to use

  • to add responsibilities to individual objects dynamically and transparently, that is, without affecting other objects
  • for responsibilities that can be withdrawn
  • when extension by subclassing is impractical