public void removeDied(animal a) { if (a.IsDied == true) { animals.Remove(a); if (a.type == "bird") { birds.Remove(a as bird); } if (a.type == "mammal") { mammals.Remove(a as mammal); } } }
public void add(animal a) { if (a.age < 10) { animals.Add(a); if (a.type == "bird") { birds.Add(a as bird); } if (a.type == "mammal") { mammals.Add(a as mammal); } } a.animalZoo += removeDied; }