Ejemplo n.º 1
0
 public Cage(int capacity, bool clean, Animal animal) : this(capacity, clean)
 {
     if (capacity > 0 && animal != null)
     {
         AnimalsInCage.Add(animal);
     }
 }
Ejemplo n.º 2
0
 public void PutAnimalInCage(Animal animal)
 {
     if (animal == null)
     {
         return;
     }
     if (AnimalsInCage.Count == Capacity)
     {
         Console.WriteLine($"Could not add {animal}, cage {Identificator} is full!");
     }
     else if (!AnimalsInCage.Contains(animal))
     {
         AnimalsInCage.Add(animal);
     }
     else
     {
         Console.WriteLine($"{animal} is already in cage {Identificator}!");
     }
 }