Open main menu

CDOT Wiki β

Changes

Decorator

246 bytes added, 13:19, 1 March 2007
Example
----
public abstract class InputStream implements Closeable { abstract int read(); }
public
class FileInputStream extends InputStream
{
int read();
}
public
class FilterInputStream extends InputStream {
{
int read();
}
public
class FileInputStream PushbackInputStream extends InputStreamFilterInputStream { public int read(){ ensureOpen(); if (pos < buf.length) { return buf[pos++] & 0xff; } return super.read(); } {}
==References==
Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John (1994). Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley. ISBN 0-201-63361-2.
http://www.dofactory.com/Patterns/PatternDecorator.aspx
1
edit