Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IDuck   duck          = new Duck();
            ITurkey turkey        = new Turkey();
            IDuck   turkeyAdapter = new TurkeyAdapter(turkey);

            Console.WriteLine();
            duck.Fly();
            duck.Quack();

            Console.WriteLine();
            turkey.Fly();
            turkey.Gobble();

            Console.WriteLine();
            turkeyAdapter.Fly();
            turkeyAdapter.Quack();

            Console.WriteLine();
            Action(duck);

            Console.WriteLine();
            Action(turkeyAdapter);

            Console.ReadKey();
        }
Exemplo n.º 2
0
 static void TestDuck(Duck duck)
 {
     duck.Fly();
     duck.Quack();
 }