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(); }
static void TestDuck(Duck duck) { duck.Fly(); duck.Quack(); }