Beispiel #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Duck-O-Rama Duck Simulator v1.0");
            Console.WriteLine("-------------------------------");
            Console.WriteLine();


            Duck pekingDuck = new PekingDuck();

            pekingDuck.DisplayInfo();
            pekingDuck.Fly();
            pekingDuck.Quack();
            pekingDuck.Swim();

            Console.WriteLine();

            Duck rubberDuck = new RubberDuck();

            rubberDuck.DisplayInfo();
            rubberDuck.Fly();
            rubberDuck.Quack();
            rubberDuck.Swim();

            Console.WriteLine();


            Console.WriteLine("Something strange happened. A rubber duck that can FLY.");
            rubberDuck.SetFlyBehaviour(new FlyWithWings());
            rubberDuck.DisplayInfo();
            rubberDuck.Fly();
            rubberDuck.Quack();
            rubberDuck.Swim();

            Console.ReadKey();
        }
Beispiel #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();
        }
Beispiel #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();
        }