Exemplo n.º 1
0
        private static void DoWork()
        {
            Duck mallard = new MallardDuck();

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

            Duck model = new ModelDuck();

            model.Display();
            model.PerformFly();
            model.SetFlyBehaviour(new FlyRocketPowered());
            model.PerformFly();

            IQuackBehavior duckCaller = new DuckCaller();

            duckCaller.Quack();
        }
Exemplo n.º 2
0
        public static void Main(String[] args)
        {
            Duck mallard = new MallardDuck();

            mallard.performQuack();
            mallard.performFly();
            mallard.display();
            System.Console.WriteLine();

            Duck model = new ModelDuck();

            model.performFly();
            model.setFlyBehavior(new FlyRocketPowered());
            model.performFly();
            model.display();
            System.Console.WriteLine();

            DuckCall duckCall = new DuckCall();

            duckCall.performQuack();
            duckCall.performFly();
            duckCall.display();
            System.Console.ReadKey();
        }