예제 #1
0
        static void Main(string[] args)
        {
            Duck mallarDuck = new MallarDuck();

            mallarDuck.PerformFly();
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Duck mallarDuck = new MallarDuck();

            mallarDuck.Display();
            mallarDuck.PerformQuack();
            mallarDuck.PerformFly();

            Console.WriteLine();

            Duck modelDuck = new ModelDuck();

            modelDuck.Display();
            modelDuck.PerformQuack();
            modelDuck.PerformFly();
            //динамичекое изменение поведения во время выполнения
            modelDuck.SetFlyBehavior(new FlyRocketPowered());
            modelDuck.PerformFly();

            Console.ReadKey();
        }