Exemplo n.º 1
0
        public 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();
            Console.Read();
        }
        public static void RunTest()
        {
            Console.WriteLine("Testing mallard duck: ");
            Duck mallard = new MallardDuck();

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

            Console.WriteLine("\nTesting model duck [+rocket power]");
            Duck model = new ModelDuck();

            model.PerformQuack();
            model.PerformFly();
            model.FlyBehavior = new FlyRocketPowered();
            model.PerformFly();
        }