Beispiel #1
0
 public static void AddAnimalAndFeedIt(Animal animal, List <Animal> animalList)
 {
     Console.WriteLine(animal.ProduceSound());
     animalList.Add(animal);
     try
     {
         var foodPortion = FoodFactory.Instantiate(Console.ReadLine());
         animal.Feed(foodPortion);
     }
     catch (ArgumentException exception)
     {
         Console.WriteLine(exception.Message);
     }
 }