public static void Main(string[] args) { Duck mallard = new MallardDuck(new FlyWithWings(), new Quack()); mallard.PerformQuack(); mallard.PerformFly(); mallard.flyBehavior = new FlyNoWay(); mallard.PerformFly(); Duck model = new ModelDuck(new FlyWithWings(), new Quack()); model.PerformFly(); }
static void Main(string[] args) { var rubber = new MallardDuck(); rubber.PerformQuack(); rubber.PerformFly(); rubber.setFlyBehavior(new FlyNoWay()); rubber.setQuackBehavior(new QuackNoWay()); rubber.PerformQuack(); rubber.PerformFly(); //var decoyDuck = new DecoyDuck(); //decoyDuck.PerformQuack(); //decoyDuck.PerformFly(); Console.ReadKey(); }
static void Main() { Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); Duck modelDuck = new ModelDuck(); modelDuck.PerformFly(); modelDuck.FlyBehavior = new FlyRocketPowered(); modelDuck.PerformFly(); }
static void Main(string[] args) { var mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); var model = new ModelDuck(); model.PerformFly(); model.FlyBehavior = new FlyRocketPowered(); model.PerformFly(); }
private static void Main() { AbstractDuck.Duck mallard = new MallardDuck(); mallard.PerformQuack(); mallard.PerformFly(); AbstractDuck.Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); Console.ReadKey(); }
static void Main(string[] args) { Duck mallard = new MallardDuck(); mallard.PerformFly(); mallard.PerformQuack(); Duck model = new ModelDuck(); model.PerformFly(); model.SetFlyBehavior(new FlyRocketPowered()); model.PerformFly(); Console.ReadLine(); }