Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("***Decorator pattern Demo***\n");
            ConcreteComponent    cc         = new ConcreteComponent();
            ConcreteDecoratorEx1 decorator1 = new ConcreteDecoratorEx1();

            decorator1.SetTheComponent(cc);
            decorator1.MakeHouse();
            ConcreteDecoratorEx2 decorator2 = new ConcreteDecoratorEx2();

            //Adding results from decorator1
            decorator2.SetTheComponent(decorator1);
            decorator2.MakeHouse();
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            Console.WriteLine("***Decorator pattern***\n");
            ConcreteComponent cc = new ConcreteComponent();

            ConcreteDecoratorEx1 dc1 = new ConcreteDecoratorEx1();

            dc1.SetTheComponent(cc);
            dc1.MakeHouse();

            ConcreteDecoratorEx2 dc2 = new ConcreteDecoratorEx2();

            dc2.SetTheComponent(dc1);
            dc2.MakeHouse();

            Console.ReadLine();
        }