Пример #1
0
        public static void Main(string[] args)
        {
            RubberDuck rduck = new RubberDuck();

            rduck.PerformFly();
            rduck.PerfromQuack();

            Console.WriteLine("Adding RocketFly behavior to the rubber duck");
            rduck.flyBehaviorObj = new RocketFlyBehavior();

            rduck.PerformFly();

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            DuckBase duck1 = new MallardDuck("Mallard Duck");

            duck1.Display();
            duck1.Swim();
            duck1.PerformFly();
            duck1.PerformQuack();
            Console.WriteLine();

            DuckBase duck2 = new DecoyDuck("Decoy Duck");

            duck2.Display();
            duck2.Swim();
            duck2.PerformFly();
            duck2.PerformQuack();
            Console.WriteLine();

            DuckBase duck3 = new RubberDuck("Rubber Duck");

            duck3.Display();
            duck3.Swim();
            duck3.PerformFly();
            duck3.PerformQuack();
        }
        static void Main(string[] args)
        {
            Duck mallard = new MallardDuck();

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

            Duck model = new ModelDuck();

            model.Display();
            model.PerformQuack();
            model.PerformFly();
            model.SetFlyBehaviour(new FlyRocketPowered());
            model.PerformFly();
            Console.WriteLine();

            Duck decoy = new DecoyDuck();

            decoy.Display();
            decoy.PerformQuack();
            decoy.PerformFly();
            decoy.SetQuackBehaviour(new Squeak());
            Console.WriteLine();

            Duck rubber = new RubberDuck();

            rubber.Display();
            rubber.PerformQuack();
            rubber.PerformFly();
            rubber.Swim();
            Console.WriteLine();
        }
Пример #4
0
        static void Main()
        {
            Duck RubberDuck = new RubberDuck();

            RubberDuck.PerformFly();
            RubberDuck.PerformQuack();
            Console.ReadKey();
        }
Пример #5
0
        static void Main(string[] args)
        {
            Duck myDuck = new MallardDuck();

            myDuck.Display();
            myDuck.PerformFly();
            myDuck.PerformQuack();
            myDuck.SetFlyBehavior(new FlyWithWingsTypeTwo());
            myDuck.SetQuackBehavior(new NoQuack());
            myDuck.PerformFly();
            myDuck.PerformQuack();

            myDuck = new RubberDuck();
            myDuck.Display();
            myDuck.PerformFly();
            myDuck.PerformQuack();
            myDuck.SetFlyBehavior(new FlyWithJet());
            myDuck.SetQuackBehavior(new QuackLikeMallardDuck());
            myDuck.PerformFly();
            myDuck.PerformQuack();
        }
Пример #6
0
        static void Main(string[] args)
        {
            RubberDuck rubberDuck = new RubberDuck();

            rubberDuck.disPlay();
            rubberDuck.PerformFly();

            BlackDuck blackDuck = new BlackDuck();

            blackDuck.disPlay();
            blackDuck.PerformFly();
            blackDuck.setFlyBehavior(new FlyWithRocket());
            blackDuck.PerformFly();
        }
Пример #7
0
        static void Main(string[] args)
        {
            Duck cityduck = new CityDuck();

            cityduck.PerformFly();
            cityduck.PerformQuack();


            Duck rubberduck = new RubberDuck();

            rubberduck.PerformFly();
            rubberduck.PerformQuack();
            Console.ReadLine();
        }
Пример #8
0
        static void Main(string[] args)
        {
            Duck Mallard = new MallardDuck();

            Mallard.Display();
            Mallard.PerformQuack();
            Mallard.PerformFly();

            Duck Model = new ModelDuck();

            Console.WriteLine();
            Model.Display();
            Model.PerformQuack();
            Model.PerformFly();
            Model.SetFlyBehavior(new FlyRocketPowered());
            Model.PerformFly();

            Duck Redhead = new RedheadDuck();

            Console.WriteLine();
            Redhead.Display();
            Redhead.PerformQuack();
            Redhead.PerformFly();

            Duck Rubber = new RubberDuck();

            Console.WriteLine();
            Rubber.Display();
            Rubber.PerformQuack();
            Rubber.PerformFly();

            Duck Decoy = new DecoyDuck();

            Console.WriteLine();
            Decoy.Display();
            Decoy.PerformQuack();
            Decoy.PerformFly();
        }