예제 #1
0
        private static void TurkeyTestDrive()
        {
            IDuck   duck        = new MallardDuck();
            ITurkey duckAdapter = new DuckAdapter(duck);

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine("The DuckAdapter says...");
                duckAdapter.Gobble();
                duckAdapter.Fly();
            }
        }
예제 #2
0
        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();
        }