Esempio n. 1
0
        static void Main(string[] args)
        {
            // example 1
            TargetSiparis targetSiparis = new AdapterSiparis();

            targetSiparis.Siparis();
            Console.WriteLine("");

            // example 2
            IDusman dusman = new DusmanRobotuAdapter();

            dusman.AracHizi();
            dusman.Silah();
            dusman.SurucuIsmi("parla");

            IDusman dusman1 = new DusmanTanki();

            dusman1.AracHizi();
            dusman1.Silah();
            dusman1.SurucuIsmi("ayse");
            Console.WriteLine("");

            //example3
            Fax fax = new Fax {
                FaxErrorCode = 001, ErrorDescription = "Cevap yok"
            };

            IError[] error =
            {
                new DbError      {
                    ErrorNumber = 002, Description = "Veri bulunamadı"
                },
                new ServiceError {
                    ErrorNumber = 003, Description = "yetki sağlanamadı"
                },
                new FaxAdapter(fax)
            };
            foreach (var item in error)
            {
                item.SendMail();
            }

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            DusmanTank t1 = new DusmanTank();

            t1.SilahKullan();
            t1.Hizlan();
            t1.DusmanAdi("Düşman1");

            DusmanRobotu robot1 = new DusmanRobotu();

            robot1.YumrukAt();
            robot1.Yuru();
            robot1.RobotIsim("Asimo");

            /* Adaptasyonu burada kullanıyoruz. */
            IDusman dusman = new DusmanRobotuAdapter(robot1);

            dusman.SilahKullan();
            dusman.Hizlan();
            dusman.DusmanAdi("Kadir");

            Console.ReadLine();
        }