Exemple #1
0
 public void Feed(Animal animal, IEdible product, int quantity)
 {
     product.Quantity -= quantity;
     animal.Eat(product, quantity);
 }
Exemple #2
0
 public void Feed(Animal animal, IEdible edibleProduct, int productQuantity)
 {
     animal.Eat(edibleProduct, productQuantity);
     edibleProduct.Quantity -= productQuantity;
 }
Exemple #3
0
 public void Feed(Animal animal, IEdible product, int quantity)
 {
     product.Quantity -= quantity;
     animal.Eat(product, quantity);
 }
Exemple #4
0
        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);
        }
 public void Feed(Animal animal, IEdible edibleProduct, int productQuantity)
 {
     animal.Eat(edibleProduct, productQuantity);
     edibleProduct.Quantity -= productQuantity;
 }