예제 #1
0
 protected abstract void ValidateFood(Food food);
예제 #2
0
 protected void Throw(Food food)
 {
     throw new ArgumentException($"{this.GetType().Name} does not eat {food.GetType().Name}!");
 }
예제 #3
0
        public virtual void EatFood(Food food)
        {
            ValidateFood(food);

            this.FoodEaten += food.FoodQuantity;
        }
예제 #4
0
파일: Dog.cs 프로젝트: RositsaRuseva/CSharp
        protected override bool IsFoodValid(Food food)

        => food.GetType().Name == "Meat" ? true : false;