Пример #1
0
        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]);
        }
Пример #2
0
 public void MakeDecision()
 {
     foreach (var animal in Animals)
     {
         _animalHandler.Pet(animal);
     }
 }