예제 #1
0
        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();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Duck duck = new MallardDuck();

            duck.Display();
            duck.PerformFly();
            duck.PerformQuack();

            duck = new RubberDuck();
            duck.Display();
            duck.PerformFly();
            duck.PerformQuack();
        }
예제 #3
0
        static void Main(string[] args)
        {
            Duck mallardDuck = new MallardDuck();

            mallardDuck.Display();
            mallardDuck.Swim();
            mallardDuck.PerformMakeSound();
            mallardDuck.PerformFly();

            Console.WriteLine("----------------------------");

            Duck rubberDuck = new RubberDuck();

            rubberDuck.Display();
            rubberDuck.Swim();
            rubberDuck.PerformMakeSound();
            rubberDuck.PerformFly();

            Console.ReadLine();
        }