1
edit
Changes
→Motivation
==Motivation==
As an example we can look at graphical user interface toolkits where we want to add responsibility such as scrolling behaviour or border property to individual objects, not to an entire class. By using inheritance to add responsibility to a user interface component is inflexible because it is made statically. A better approach is wrapping the decorator component in another object dynamically.
==Sample Code==