static void Main()
        {
            IDuck duck = new MallardDuck();

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

            ITurkey turkey = new WildTurkey();

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

            IDuck adapter = new DuckAdapter(turkey);

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

            Console.ReadLine();
        }
        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();
        }
Esempio n. 3
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();
        }