static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); }
static void Main(string[] args) { Duck duck = new MallardDuck(); duck.Display(); duck.PerformFly(); duck.PerformQuack(); duck = new RubberDuck(); duck.Display(); duck.PerformFly(); duck.PerformQuack(); }
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(); }