public void Feed(Animal animal, IEdible product, int quantity) { product.Quantity -= quantity; animal.Eat(product, quantity); }
public void Feed(Animal animal, IEdible edibleProduct, int productQuantity) { animal.Eat(edibleProduct, productQuantity); edibleProduct.Quantity -= productQuantity; }
public void Feed(Animal animal, IEdible edibleProduct, int productQuantity) { if (animal == null) { throw new ArgumentNullException("animal"); } if (edibleProduct == null) { throw new ArgumentNullException("edibleProduct"); } if (edibleProduct.Quantity < 0) { throw new ArgumentException("edibleProduct"); } animal.Eat(edibleProduct, productQuantity); }