コード例 #1
0
        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();
        }
コード例 #2
0
 public BookShelfIterator(BookShelf bookShelf)
 {
     this.bookShelf = bookShelf;
     this.index     = 0;
 }