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
 public void Quack()
 {
     turkey.Gobble();
 }
Exemplo n.º 3
0
 public string quack()
 {
     return(turkey.Gobble());
 }