public static void Main(string[] args) { List <Animal> animals = new List <Animal>(); animals.Add(new Dog()); animals.Add(new Cat()); var handler = new AnimalHandler(); handler.Pet((dynamic)animals[0]); handler.Pet((dynamic)animals[1]); }
public void MakeDecision() { foreach (var animal in Animals) { _animalHandler.Pet(animal); } }