static void Main(string[] args)
        {
            Duck myduck = new MallardDuck();

            myduck.display();
            myduck.performFly();
            myduck.performQuack();

            myduck = new RedHeadDuck();
            myduck.display();
            myduck.performFly();
            myduck.performQuack();

            myduck = new RubberDuck();
            myduck.display();
            myduck.performFly();
            myduck.performQuack();

            myduck = new DecoyDuck();
            myduck.display();
            myduck.performFly();
            myduck.performQuack();

            myduck.setFlyBehavior(new FlyJet());
            myduck.performFly();
        }
Beispiel #2
0
 static void Main(string[] args)
 {
     Duck duck = new MarroldDuck();
     duck.display();
     duck.performQuack();
     duck.performFly();
     duck = new RubberDuck();
     duck.display();
     duck.performQuack();
     duck.performFly();
 }