static void Main(string[] args) { Duck mallardDuck = new MallardDuck(); mallardDuck.Display(); mallardDuck.PerformFly(); mallardDuck.PerformQuack(); mallardDuck.SetFlyingBehaviour(new FlyWithRocket()); mallardDuck.PerformFly(); Console.WriteLine(); Console.WriteLine(); Duck plasticDuck = new PlasticDuck(); plasticDuck.Display(); plasticDuck.PerformFly(); plasticDuck.PerformQuack(); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.Display(); mallard.PerformeFly(); mallard.PerformeQuack(); Duck model = new ModelDuck(); model.Display(); model.PerformeFly(); model.FlyBehavior = new FlyRocketPowered(); model.PerformeFly(); Console.ReadKey(); }