public void Execute() { IAnimal animal = (T)Activator.CreateInstance(typeof(T), new object[] { _name, _age }); if (_account.CanRemoveFunds(animal.GetPrice())) { _account.RemoveFunds(animal.GetPrice()); _animals.Add(animal); } }
public void Add(IAnimal animal) => Animals.Add(animal);