Chapter 9. Decorator Pattern

<feature><title>In This Chapter</title> </feature>

The Decorator pattern enables you to apply new behavior to an object at runtime. Traditionally, many developers learn to add behavior by using inheritance rather than composition. This means that if you want to add a move() method to an existing Widget class, you’d extend Widget to define a new MovableWidget class. Or, if you want to redefine the move() method of MovableWidget so that it moves only until its fuel is used up, you could extend MovableWidget to define FuelableMovableWidget.

However, inheritance has two major drawbacks in such cases: ...

Get Advanced ActionScript 3 with Design Patterns now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.