Exemplo n.º 1
0
        static void Main(string[] args)
        {
            PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu();
            DinerMenu        dinerMenu        = new DinerMenu();

            Waitress waitress = new Waitress(pancakeHouseMenu, dinerMenu);

            waitress.PrintMenu();

            Console.ReadKey();
        }
Exemplo n.º 2
0
 //服务员在这里依赖了具体的菜单
 //尽管菜单都实现了统一的接口CreateIterator
 public Waitress(PancakeHouseMenu pancakeHouseMenu, DinerMenu dinerMenu)
 {
     this.pancakeHouseMenu = pancakeHouseMenu;
     this.dinerMenu        = dinerMenu;
 }