public static double GetAvgAge(Animal[] animal) { double avgAge = 0; int currentSum = 0; for (int i = 0; i < animal.Length; i++) { currentSum += animal[i].Age; } avgAge = (double)currentSum/animal.Length; return avgAge; }
public static void GetAnimalBySound(Animal animal) { Console.WriteLine("{0} is: {1}",animal.Name,animal.GetType().Name); }