Пример #1
0
        private static void Main(string[] args)
        {
            var breakfast = new BreakfastMenu();
            var dinner    = new DinnerMenu();
            var waiter    = new Client(breakfast, dinner);

            waiter.PrintMenu();

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var pancakeMenu = new PancakeHouseMenu();
            var dinnerMenu  = new DinnerMenu();
            var cafeMenu    = new CafeMenu();

            var waitress = new Waitress(pancakeMenu, dinnerMenu, cafeMenu);

            waitress.PrintMenu();
        }
Пример #3
0
        static void Main(string[] args)
        {
            PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu();
            DinnerMenu       dinnerMenu       = new DinnerMenu();

            Waitress waitress = new Waitress(pancakeHouseMenu, dinnerMenu);

            waitress.PrintMenu();

            Console.ReadLine();
        }
Пример #4
0
        static void Main(string[] args)
        {
            PancakeHouseMenu pancakeMenu = new PancakeHouseMenu();
            DinnerMenu       dinnerMenu  = new DinnerMenu();

            #region Bad implementation of PrintMenu() method

            //List<MenuItem> breakfastItems = pancakeMenu.MenuItems; // waitress is dependent on type List<MenuItem>
            //MenuItem[] dinnerItems = dinnerMenu.MenuItems; // waitress is also dependent on type MenuItem[]

            //foreach (var menuItem in breakfastItems)
            //{
            //    Console.WriteLine(menuItem.Name);
            //    Console.WriteLine(menuItem.Price);
            //    Console.WriteLine(menuItem.Description);
            //}

            //foreach (var menuItem in dinnerItems)
            //{
            //    Console.WriteLine(menuItem.Name);
            //    Console.WriteLine(menuItem.Price);
            //    Console.WriteLine(menuItem.Description);
            //}

            #endregion

            IIterator <MenuItem> pancakeIterator = pancakeMenu.CreateIterator();
            IIterator <MenuItem> dinnerIterator  = dinnerMenu.CreateIterator();

            Console.WriteLine("---Menu---");
            Console.WriteLine();
            Console.WriteLine("--Breakfast--");
            PrintMenu(pancakeIterator);
            Console.WriteLine();
            Console.WriteLine("--Lunch--");
            PrintMenu(dinnerIterator);
        }
Пример #5
0
 public Client(BreakfastMenu breakfast, DinnerMenu dinner)
 {
     this._breakfast = breakfast.Items;
     this._dinner    = dinner.Items;
 }
Пример #6
0
 public Waitress(PancakeHouseMenu pancakeHouseMenu, DinnerMenu dinnerMenu)
 {
     this.pancakeHouseMenu = pancakeHouseMenu;
     this.dinerMenu        = dinnerMenu;
 }
Пример #7
0
 public Waitress(PancakeHouseMenu pancakeHouseMenu, DinnerMenu dinnerMenu, CafeMenu cafeMenu)
 {
     _pancakeHouseMenu = pancakeHouseMenu;
     _dinnerMenu       = dinnerMenu;
     _cafeMenu         = cafeMenu;
 }