Пример #1
0
 public object visit(meat m) // can't be red meat!
 {
     if ((m.kind == Meattype.white) && m.Calories < min.Calories)
     {
         min = m;
     }
     return(m.nextitem.accept(this));
 }
Пример #2
0
 public object visit(meat m)
 {
     Console.WriteLine("I'm eating " + m + " now");
     cals += m.Calories;
     if (cals < max)
     {
         return(m.nextitem.accept(this));
     }
     else
     {
         return(cals);
     }
 }
Пример #3
0
 public object visit(meat m)
 {
     foodSum += m.Calories;
     return(m.nextitem.accept(this));
 }
Пример #4
0
 public object visit(meat m)
 {
     state = "meat";
     return(m.nextitem.accept(this));
 }