static void Main(string[] args) { Console.WriteLine("Decorator Pattern \n"); IComponent component = new Component(); Display("A: BasicPattern", component); Display("B: DecoratorAPattern", new DecoratorA(component)); Display("C: DecoratorBPattern", new DecoratorB(component)); Display("D: MixedPattern A>>B>> ", new DecoratorA(new DecoratorB(component))); Display("E: MixedPattern B>>A>>C ", new DecoratorB(new DecoratorA(component))); DecoratorB b = new DecoratorB(new Component()); Console.WriteLine("F: " + new DecoratorA(b)); Console.WriteLine(b.addBehavior()); Console.WriteLine(b.addState); }
public ConcreteDecorator1(Component comp) : base(comp) { }
public Decorator(Component component) { _component = component; }
public void SetComponent(Component component) { this.component = component; }
public void SetComponent(Component component) { Component = component; }
public Decorator(Component component) { this.component = component; }