Exemple #1
0
 static void PrintReporters(INewspaperIterator iterator)
 {
     iterator.First();
     while (!iterator.IsDone())
     {
         Console.WriteLine(iterator.Next());
     }
 }
Exemple #2
0
        public static void Main(string[] args)
        {
            INewspaper nyp = new NyTimesPaper();
            INewspaper lap = new LaPaper();

            INewspaperIterator nypIterator = nyp.CreateNewspaperIterator();
            INewspaperIterator lapIterator = lap.CreateNewspaperIterator();

            Console.WriteLine("--------   NYPaper");
            PrintReporters(nypIterator);

            Console.WriteLine("--------   LAPaper");
            PrintReporters(lapIterator);

            Console.ReadLine();
        }