示例#1
0
 public override void Feed(IPetFood food)
 {
     if (food is Fish)
     {
         Eat(food);
     }
     else
     {
         Meow();
     }
 }
示例#2
0
 protected void Eat(IPetFood food)
 {
     _hunger -= food.Energy;
 }
示例#3
0
 public virtual void Feed(IPetFood food)
 {
     Eat(food);
 }
示例#4
0
 public static void PetFeed <TP, TF>(PetAnimal petAnimal, IPetFood petFood) where TP : PetAnimal
     where TF : IPetFood
 {
     petAnimal.Feed(petFood);
 }