예제 #1
0
 public override void Drink(DrinkableFluid fluid, int ml)
 {
     if (fluid is Alcohol)
     {
         throw new ArgumentException("Children can't drink alcohol");
     }
     this.ConsumedCalories += Convert.ToInt32(ml * fluid.CaloriesPerMl);
 }
예제 #2
0
 public virtual void Drink(DrinkableFluid fluid, int ml)
 {
     if (fluid == null)
     {
         throw new ArgumentException("Fluid can't be null");
     }
     if (ml < 0)
     {
         throw new ArgumentException("Can't drink less than 0 ml of fluid");
     }
     this.ConsumedCalories += Convert.ToInt32(ml * fluid.CaloriesPerMl);
 }