示例#1
0
        static void Main(string[] args)
        {
            MallardDuck mallardDuck = new MallardDuck();

            PlayWithDuck(mallardDuck);

            RedheadDuck redheadDuck = new RedheadDuck();

            PlayWithDuck(redheadDuck);

            RubberDuck rubberDuck = new RubberDuck();

            PlayWithDuck(rubberDuck);

            DecoyDuck decoyDuck = new DecoyDuck();

            PlayWithDuck(decoyDuck);

            ModelDuck modelDuck = new ModelDuck();

            PlayWithDuck(modelDuck);
            modelDuck.SetFly(FlyBehavior.FlyWithWings());
            PlayWithDuck(modelDuck);
        }