Exemplo n.º 1
0
 private static void DoMallardDuckNewState(IDuck duck)
 {
     Console.WriteLine("Dynamically set behavior to a object. Looks like model duck will fly at the end.");
     duck.SetFlyBehavior(new FlyRockedPowered());
     Console.Write($"{duck.GetType().Name} : ");
     duck.PerformFly();
 }
Exemplo n.º 2
0
 private static void DoIronManDuckNewState(IDuck duck)
 {
     Console.WriteLine("At the end, the rocket jet pack on the back of the IRONDUCK starts up..");
     duck.SetFlyBehavior(new FlyRockedPowered());
     Console.Write($"{duck.GetType().Name} : ");
     duck.PerformFly("Гааа-аа--аа--ззз-зз.....");
 }