static void Main(string[] args)
    {
        Duck mallard = new MallardDuck();

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

        Duck model = new ModelDuck();

        model.PerformFly();
        model.SetFlyBehaviour(new FlyRocketPowered());
        model.PerformFly();
    }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            MallardDuck mallard = new MallardDuck();
            RedHeadDuck redHead = new RedHeadDuck();
            RubberDuck  rubber  = new RubberDuck();
            DecoyDuck   decoy   = new DecoyDuck();
            RobotDuck   robot   = new RobotDuck();
            ModelDuck   model   = new ModelDuck();

            PerformDuckFunctions(mallard);
            PerformDuckFunctions(redHead);
            PerformDuckFunctions(rubber);
            PerformDuckFunctions(decoy);
            PerformDuckFunctions(robot);
            PerformDuckFunctions(model);

            model.SetFlyBehaviour(new FlyRocketPowered());
            PerformDuckFunctions(model);

            Console.ReadKey();
        }