示例#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));
 }