示例#1
0
文件: Program.cs 项目: JvPost/DP
        static void Main(string[] args)
        {
            MallardDuck duck = new MallardDuck();

            WildTurkey    turkey        = new WildTurkey();
            TurkeyAdapter TurkeyAdapter = new TurkeyAdapter(turkey);


            Console.WriteLine();

            Console.WriteLine("The turkey says....");
            turkey.Gobble();
            turkey.Fly();


            Console.WriteLine();

            Console.WriteLine("The duck says....");
            TestDuck(duck);

            Console.WriteLine();

            Console.WriteLine("The turkey says....");
            TestDuck(TurkeyAdapter);

            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            IDuck fakeDuck = new TurkeyAdapter(new WildTurkey());

            fakeDuck.Quack();
            fakeDuck.Fly();
        }
示例#3
0
        static void Main(string[] args)
        {
            IDuck fake_duck = new TurkeyAdapter(new WildTurkey());

            fake_duck.Quack();
            fake_duck.Fly();

            Console.ReadKey();
        }
示例#4
0
        static void Main(string[] args)
        {
            MallardDuck mallardDuck   = new MallardDuck();
            WildTurkey  wildTurkey    = new WildTurkey();
            Duck        turkeyAdapter = new TurkeyAdapter(wildTurkey);

            turkeyAdapter.Fly();
            turkeyAdapter.Quack();
        }
示例#5
0
        private static void Main()
        {
            var duck          = new MallardDuck();
            var turkey        = new WildTurkey();
            var turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says...");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("\nThe Duck says...");
            TestDuck(duck);

            Console.WriteLine("\nThe TurkeyAdapter says...");
            TestDuck(turkeyAdapter);
        }
        private void Start()
        {
            MallarDuck duck = new MallarDuck();

            WildTurkey turkey        = new WildTurkey();
            IDuck      turkeyAdapter = new TurkeyAdapter(turkey);

            turkey.Gobble();
            turkey.Fly();

            turkeyAdapter.Quack();
            turkeyAdapter.Fly();

            duck.Quack();
            duck.Fly();
        }
示例#7
0
        static void Main()
        {
            MallardDuck mallardDuck = new MallardDuck();
            WildTurkey  wildTurkey  = new WildTurkey();

            IDuck turkeyAdapter = new TurkeyAdapter(wildTurkey);

            Console.WriteLine("\nThe Turkey says...");
            wildTurkey.Gobble();
            wildTurkey.Fly();

            Console.WriteLine("\nThe Duck says");
            TestDuck(mallardDuck);

            Console.WriteLine("\nThe TurkeyAdapter says");
            TestDuck(turkeyAdapter);
        }
示例#8
0
        public static void Adapter()
        {
            MallardDuck duck = new MallardDuck();

            WildTurkey turkey = new WildTurkey();

            Duck turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("The Duck says...");
            TestDuck(duck);

            Console.WriteLine("The Turkey Adapter says...");
            TestDuck(turkeyAdapter);
        }
        static void Main(string[] args)
        {
            IDuck duck = new WildDuck();

            duck.Quack();
            duck.Fly();

            ITurkey turkey = new Turkey();

            turkey.Gobble();
            turkey.Fly();

            TurkeyAdapter adapter = new TurkeyAdapter(turkey);

            adapter.Quack();
            adapter.Fly();

            Console.ReadKey();
        }
示例#10
0
        static void Main(string[] args)
        {
            WildTurkey  turkey = new WildTurkey();
            MallardDuck duck   = new MallardDuck();


            Duck turkeyAdapter = new TurkeyAdapter(turkey);

            turkeyAdapter.Fly();
            turkeyAdapter.Quack();

            //Console.WriteLine("The turkey says");
            //turkey.Gobble();
            //turkey.fly();
            //Console.WriteLine("The duck says");
            //testDuck(duck);
            //Console.WriteLine("The TurkeyAdapter says");
            //testDuck(turkeyAdapter);
        }
        static void Main(string[] args)
        {
            //Se crean objetos Pato y Pavo.
            MallardDuck duck   = new MallardDuck();
            WildTurkey  turkey = new WildTurkey();
            //Se crea un Pavo disfrazado de Pato envolviendolo en un adaptador.
            IDuck turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says: ");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("\nThe Duck says: ");
            duck.Quack();
            duck.Fly();

            Console.WriteLine("\nThe Undercover Turkey says: ");
            testDuck(turkeyAdapter);
            Console.ReadKey();
        }
示例#12
0
        static void Main(string[] args)
        {
            MallardDuck duck = new MallardDuck();

            WildTurkey turkey        = new WildTurkey();
            IDuck      turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine("The Turkey says:");
            turkey.Gobble();
            turkey.Fly();

            Console.WriteLine("\nThe Duck says:");
            duck.Quack();
            duck.Fly();

            Console.WriteLine("\nThe Turkey Adapter says:");
            TestDuck(turkeyAdapter);

            Console.ReadLine();
        }
示例#13
0
        static void Main(string[] args)
        {
            WildDuck wildDuck = new WildDuck();

            WildTurkey wildTurkey    = new WildTurkey();
            IDuck      turkeyAdapter = new TurkeyAdapter(wildTurkey);
            ITurkey    duckAdapter   = new DuckAdapter(wildDuck);

            Console.WriteLine("Indyk mówi:");
            wildTurkey.Bubble();
            wildTurkey.Fly();

            Console.WriteLine("Kaczka mówi:");
            TestDuck(wildDuck);

            Console.WriteLine("Adapter indyka mówi");
            TestDuck(turkeyAdapter);

            Console.WriteLine("Adapter kaczki mówi:");
            TestTurkey(duckAdapter);

            Console.ReadKey();
        }