This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: IComponent component = new Component() Display("1. Basic component: ", component) Display("2. A-decorated : ", new DecoratorA(component)) Display("3. B-decorated : ", new DecoratorB(component)) Display("4. B-A-decorated : ", new DecoratorB( new DecoratorA(component))) // Explicit DecoratorB DecoratorB b = new DecoratorB(new Component()) Display("5. A-B-decorated : ", new DecoratorA(b)) //Invoking its added state and added behaviour Console.WriteLine("\t\t\t"+ b.addedState + b.AddedBehavior()) } } /* Output: Decorator Pattern 1. Basic component: I am walking 2. A-decorated : I am walking and listening to Classic FM 3. B-decorated : I am walking to school 4. B-A-decorated : I am walking and listening to Classic FM to school 5. A-B-decorated : I am walking to school and listening to Classic FM past the Coffee Shop and I bought a cappucino */...
View Full Document
This note was uploaded on 11/10/2010 for the course CMPS 101 taught by Professor Tantalo,p during the Fall '08 term at UCSC.
- Fall '08