Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Duck mallardDuck = new MallardDuck();

            mallardDuck.Display();
            mallardDuck.PerformFly();
            mallardDuck.PerformQuack();
            mallardDuck.SetFlyingBehaviour(new FlyWithRocket());
            mallardDuck.PerformFly();
            Console.WriteLine();
            Console.WriteLine();

            Duck plasticDuck = new PlasticDuck();

            plasticDuck.Display();
            plasticDuck.PerformFly();
            plasticDuck.PerformQuack();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.Display();
            mallard.PerformeFly();
            mallard.PerformeQuack();

            Duck model = new ModelDuck();

            model.Display();
            model.PerformeFly();

            model.FlyBehavior = new FlyRocketPowered();
            model.PerformeFly();

            Console.ReadKey();
        }