static void Main(string[] args) { Duck mallarDuck = new MallarDuck(); mallarDuck.PerformFly(); Console.ReadKey(); }
static void Main(string[] args) { Duck mallarDuck = new MallarDuck(); mallarDuck.Display(); mallarDuck.PerformQuack(); mallarDuck.PerformFly(); Console.WriteLine(); Duck modelDuck = new ModelDuck(); modelDuck.Display(); modelDuck.PerformQuack(); modelDuck.PerformFly(); //динамичекое изменение поведения во время выполнения modelDuck.SetFlyBehavior(new FlyRocketPowered()); modelDuck.PerformFly(); Console.ReadKey(); }