public override void Init() { Display("Decorator Pattern\n"); IComponent component = new Component(); Display("1. Basic component:\t", component); Display("2. A-decorated:\t", new DecoratorA(component)); Display("3. B-decorated:\t", new DecoratorB(new DecoratorA(component))); DecoratorB b = new DecoratorB(new Component()); Display("5. A-B-decorated:\t", new DecoratorA(b)); Display("\t\t\t"+b.AddedState + b.AddedBehavior()); }
public void SetComponent(Component component) { this.component = component; }