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