Exemple #1
0
 public override void EatUp(AbstractAnimal AbstractAnimal)
 {
     if (AbstractAnimal is AnimalFly) // запрет каннибализма
     { }
     else AbstractAnimal.FallPrey();
 }
Exemple #2
0
 public abstract void EatUp(AbstractAnimal AbstractAnimal);
Exemple #3
0
 public Сreator(AbstractFactory factory)
 {
     // Абстрагирование процессов инстанцирования.
     animal = factory.CreateAnimal();
 }
Exemple #4
0
        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();
        }