예제 #1
0
파일: Program.cs 프로젝트: MyLittleSun/.Net
        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;
 }