static void Main(string[] args) { BookShelf bookShelf = new BookShelf(4); bookShelf.AppendBook(new Book("test1")); bookShelf.AppendBook(new Book("test2")); bookShelf.AppendBook(new Book("test3")); bookShelf.AppendBook(new Book("test4")); IIterator it = bookShelf.iterator(); while (it.hasNext()) { Book book = (Book)it.next(); Console.WriteLine(book.Name); } EndConsoleOut(); }
public BookShelfIterator(BookShelf bookShelf) { this.bookShelf = bookShelf; this.index = 0; }