static void Main(string[] args) { BookShelf bookShelf = new BookShelf(4); bookShelf.AppendBook(new Book("Around the World in 80 Days")); bookShelf.AppendBook(new Book("Bible")); bookShelf.AppendBook(new Book("Cinderella")); bookShelf.AppendBook(new Book("Daddy-Long-Legs")); IIterator it = bookShelf.Iterator(); while (it.HasNext()) { Book book = (Book)it.Next(); Console.WriteLine(book.Name); } Console.ReadKey(); }
public BookShelfIterator(BookShelf bookShelf) { this._bookShelf = bookShelf; this._index = 0; }