23.07.2012 Views

Design Patterns Explained

Design Patterns Explained

Design Patterns Explained

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 15-5 Setting up headers and footers to look like a report.<br />

Chapter 15 • The Decorator Pattern 245<br />

Figure 15-6 shows the application of Decorator to one header and<br />

one footer.<br />

Figure 15-6 An example Decorator object diagram.<br />

The pattern<br />

instantiated<br />

Each Decorator object wraps its new function around its trailing How it works: object.<br />

Each Decorator performs its added function either before its Decorators wrap decorated<br />

function (for headers) or after it (for footers). The easiest their trailing object way to see<br />

how it works is to look at code for a specific example and walk through it. See Example<br />

15-1.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!