예제 #1
0
        public static void Main()
        {
            Duck modelDuck = new ModelDuck();

            modelDuck.setFlyBehavior(new FlyWithRocketPower());
            modelDuck.display();
            modelDuck.performQuack();
            modelDuck.performFly();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.PerformQuack();
            mallard.PerformFly();
            mallard.Swim();

            Duck model = new ModelDuck();

            model.Display();
            model.PerformQuack();
            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();
        }