Yanniel's notes – Decorator (also referred as Wrapper) is classified by GoF as a structural pattern. Its purpose is to:“Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.” Both inheritance and the decorator pattern aim towards extending the functionality. This is what they have in common. There are a couple of remarkable differences:Inheritance extends the functionality at compilation time (statically). The decorator pattern extends the functionality at runtime (dynamically). Inheritance extends the ...
Visits by Source
Users who voted for this posting
Jørn E. Angeltveit