static void Main(string[] args)
        {
            Duck rubber = new RubberDuck();

            rubber.Display();
            rubber.PerformFly();
            rubber.FlyBehavior = FlyRocketPowered.Fly;
            rubber.PerformFly();
            rubber.PerformQuack();
            rubber.QuackBehavior = MuteQuackR.Quack;
            rubber.PerformQuack();
        }
        static void Main(string[] args)
        {
            Duck rubber = new RubberDuck();

            rubber.Display();
            rubber.PerformFly();
            rubber.SetFlyBehavior(new FlyRocketPowered());
            rubber.PerformFly();
            rubber.PerformQuack();
            rubber.SetQuackBehavior(new SqueakR());
            rubber.PerformQuack();
        }
예제 #3
0
        public static void Main(string[] args)
        {
            MallardDuck mallard      = new MallardDuck();
            RubberDuck  rubberDuckie = new RubberDuck();
            DecoyDuck   decoy        = new DecoyDuck();

            ModelDuck model = new ModelDuck();

            mallard.PerformQuack();
            rubberDuckie.PerformQuack();
            decoy.PerformQuack();

            model.PerformFly();
            model.FlyBehavior = new FlyRocketPowered();
            model.PerformFly();
        }