public object Next() { MenuItme menuItme = menuItmes[position]; position++; return(menuItme); }
private void PrintMenu(Iterator iterator) { while (iterator.HasNext()) { //取得下一个项 MenuItme menuItme = (MenuItme)iterator.Next(); Console.WriteLine(menuItme.Name); } }
public void AddItem(string name, string description, bool vegetarian, double price) { MenuItme menuItme = new MenuItme(name, description, vegetarian, price); if (numberOfImtes >= Max_Items) { Console.WriteLine("菜单已满"); } else { menuItmes[numberOfImtes] = menuItme; numberOfImtes++; } }
public void AddItem(string name, string description, bool vegetarian, double price) { MenuItme menuItme = new MenuItme(name, description, vegetarian, price); menuItmes.Add(menuItme); }