public static void Main(string[] args) {
     Duck mallard = new MallardDuck(new FlyWithWings(), new Quack());
     
     mallard.PerformQuack();
     mallard.PerformFly();
     mallard.flyBehavior = new FlyNoWay();
     mallard.PerformFly();
     
     Duck model = new ModelDuck(new FlyWithWings(), new Quack());
     model.PerformFly();
 }
Esempio n. 2
0
        static void Main()
        {
            Duck mallard = new MallardDuck();

            mallard.PerformQuack();
            mallard.PerformFly();
            Duck modelDuck = new ModelDuck();

            modelDuck.PerformFly();
            modelDuck.FlyBehavior = new FlyRocketPowered();
            modelDuck.PerformFly();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var mallard = new MallardDuck();

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

            var model = new ModelDuck();

            model.PerformFly();
            model.FlyBehavior = new FlyRocketPowered();
            model.PerformFly();
        }
Esempio n. 4
0
        private static void Main()
        {
            AbstractDuck.Duck mallard = new MallardDuck();
            mallard.PerformQuack();
            mallard.PerformFly();

            AbstractDuck.Duck model = new ModelDuck();
            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();

            Console.ReadKey();
        }
Esempio n. 5
0
        public static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.performQuack();
            mallard.performFly();

            Duck model = new ModelDuck();

            model.performFly();
            model.setFlyBehavior(new FlyRocketPowered());
            model.performFly();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

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

            Duck model = new ModelDuck();

            model.PerformFly();
            model.SetFlyBehavior(new FlyRocketPowered());
            model.PerformFly();
            Console.ReadLine();
        }