Пример #1
0
        static void Main(string[] args)
        {
            BookShelf bookShelf = new BookShelf();

            bookShelf.appendBook(new Book("Around the World in 80 Days"));
            bookShelf.appendBook(new Book("Bible"));
            bookShelf.appendBook(new Book("Cinderellda"));
            bookShelf.appendBook(new Book("Daddy-Long-Leds"));
            bookShelf.appendBook(new Book("DesignPattern"));
            Iterator it = bookShelf.iterator();

            while (it.hasNext())
            {
                Book book = (Book)it.Next();
                Console.WriteLine(book.GetName());
            }
            Console.ReadKey();
        }
Пример #2
0
 public BookShelfIterator(BookShelf bookShelf)
 {
     this.bookShelf = bookShelf;
     this.index     = 0;
 }