Esempio n. 1
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.Display();
            mallard.PerformQuack();
            mallard.PerformFly();

            Duck model = new ModelDuck();

            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();

            Console.ReadKey();
        }
Esempio n. 2
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.SetFlyBehavior(FlyBehavior.FlyWithWingsAction());
            PlayWithDuck(modelDuck);
        }