コード例 #1
0
        static void Main(string[] args)
        {
            IBilesen compnent = new Bilesen();

            Client.Display("1. basit bilesen: ", compnent);
            Client.Display("2. A Decorated: ", new DecoratorA(compnent));
            Client.Display("3. B Decorated: ", new DecoratorB(compnent));
            Client.Display("4. B-A Decorated: ", new DecoratorB(new DecoratorA(compnent)));

            DecoratorB b = new DecoratorB(new Bilesen());

            Client.Display("5. A-B Decorated", new DecoratorA(b));

            Console.WriteLine("\t\t\t" + b.EklenenDavranis());
            Console.ReadKey();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IBilesen component = new Bilesen();

            Client.Display("1. Basit bileşen: ", component);
            Client.Display("2. A-decorated : ", new DecoratorA(component));
            Client.Display("3. B-decorated : ", new DecoratorB(component));
            Client.Display("4. B-A-decorated : ", new DecoratorB(new DecoratorA(component)));

            DecoratorB b = new DecoratorB(new Bilesen());

            Client.Display("5. A-B-decorated : ", new DecoratorA(b));
            //Eklenen durmu ve davranışı çağırmak
            Console.WriteLine("\t\t\t" + b.addedState + b.EklenenDavranis());
            Console.ReadKey();
        }