Beispiel #1
0
        public void SeeProducts(Store store)
        {
            IProductIterator iterator = store.CreateNumerator();

            while (iterator.HasNext())
            {
                Product product = iterator.Next();
                Console.WriteLine("Наименование: " + product.Name + ", цена: " + new Random().Next(10, 500));
            }
        }
        public void SeeProducts(Shop shop)//посмотреть все продукты
        {
            int i = 0;
            IProductIterator iterator = shop.CreateNumerator();

            while (iterator.HasNext())
            {
                Product product = iterator.Next();
                Console.WriteLine($"{++i}) {product}");
            }
        }