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(); }
static void Main(string[] args) { Duck num1 = new MallardDuck(); num1.display(); num1.performFly(); num1.performQuack(); num1.Swim(); Duck num2 = new RedheadDuck(); num2.display(); num2.performFly(); num2.performQuack(); num2.Swim(); Duck num3 = new DecoyDuck(); num3.display(); num3.performFly(); num3.performQuack(); num3.Swim(); num3.setFlyBehavior(new FlyWithWings()); num3.performFly(); Console.Read(); }