public abstract class Animal
public string Name {get;set;}
public int Age {get;set;}
public bool Female {get;set;}
public class Cat : Animal, Pet
public string Breed {get;set;}
public string Playful {get;set;}
public new void ToString()
Console.WriteLine("Cat: a kitty is here.");
public class Fish : Animal, Pet
public string Playful{get;set;}
public new void ToString()
Console.WriteLine("Fish: Smells fishy.");
public string Name {get;set;}
public string City {get;set;}
public int Capacity {get;set;}
System.Collections.Generic.List<Animal> Animals = new System.Collections.Generic.List<Animal>();
public void zoo(string a, string b, int c)
public void addAnimal(Animal a)
public void removeAnimal(Animal a)
public void printMembers()
foreach (Animal member in Animals)
Console.WriteLine(member);
public static void Main(string[] args)
Zoo NationalZoo= new Zoo();
NationalZoo.zoo("Smithsonian's National Zoo","Washington D.C.",5000);
Console.WriteLine("Welcome to the {0},it located at {1} and has capacity of {2}.",NationalZoo.Name,NationalZoo.City,NationalZoo.Capacity);
Console.WriteLine("----------------------------------------------------------------");
Console.WriteLine("----------------------------------------------------------------");
NationalZoo.addAnimal(C1);
NationalZoo.addAnimal(F1);
NationalZoo.printMembers();
Console.WriteLine("The above two animal have been added");
Console.WriteLine("----------------------------------------------------------------");
NationalZoo.removeAnimal(C1);
Console.WriteLine("The Cat has been removed from the list, now only the animal below still in the list:");
NationalZoo.printMembers();
Console.WriteLine("----------------------------------------------------------------");