Exemplo n.º 1
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();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            #region Lab_1
            IBilesen bilesen = new Bilesen();

            Client.Display("1.Basit Bileşen: ", bilesen);
            Console.WriteLine("\n");
            Console.WriteLine("\n");
            Client.Display("2.Bileşen A-Dekaratörü Eklendi: ", new Decorator_A(bilesen));
            Console.WriteLine("\n");
            Console.WriteLine("\n");
            Client.Display("3.Bilesen B-Dekaratörü Eklendi: ", new Decorator_B(bilesen));
            Console.WriteLine("\n");
            Console.WriteLine("\n");
            Client.Display("4.Bilesen İlk Önce A-Dekaratörü sonra B-Dekaratörü Eklendi: ", new Decorator_B(new Decorator_A(bilesen)));
            Console.WriteLine("\n");
            Console.WriteLine("\n");



            Decorator_B decorator_B = new Decorator_B(new Bilesen());
            Client.Display("5.Bilesen İlk Önce B-Dekaratörü sonra B-Dekaratörü Eklendi: ", new Decorator_B(decorator_B));


            Console.WriteLine("\t\t\t" + decorator_B.EklenenDavranış());
            #endregion


            #region Lab_1
            var mycar = new SUV {
                Marka = "Dodge", Model = "2019 Ram Power Wagon", HirePrice = 55000
            };

            HireOffer hireOffer = new HireOffer(mycar);
            hireOffer.DiscountPersantage = 10;

            Console.WriteLine("First Hire Price: {0}", mycar.HirePrice);
            Console.WriteLine("Discount Applied Price: {0}", hireOffer.HirePrice);
            #endregion
            Console.ReadKey();
        }