public override void EatUp(AbstractAnimal AbstractAnimal) { if (AbstractAnimal is AnimalFly) // запрет каннибализма { } else AbstractAnimal.FallPrey(); }
public abstract void EatUp(AbstractAnimal AbstractAnimal);
public Сreator(AbstractFactory factory) { // Абстрагирование процессов инстанцирования. animal = factory.CreateAnimal(); }
public override void EatUp(AbstractAnimal abstractAnimal) { if (abstractAnimal is AnimalWalking) { AnimalWalking animalWalking = (AnimalWalking)abstractAnimal; if (this.LengthClaws > animalWalking.LengthClaws) { abstractAnimal.FallPrey(); } else { Console.WriteLine("Не вышло"); } } else abstractAnimal.FallPrey(); }