예제 #1
0
        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)
 {
 }
예제 #3
0
 public Decorator(Component component)
 {
     _component = component;
 }
예제 #4
0
 public void SetComponent(Component component)
 {
     this.component = component;
 }
예제 #5
0
 public void SetComponent(Component component)
 {
     Component = component;
 }
예제 #6
0
 public Decorator(Component component)
 {
     this.component = component;
 }