예제 #1
0
 static void Main(string[] args)
 {
     int[] requests = new int[] {1,12,23,2,15,29 };
     Handler h1 = new Handler1();
     Handler h2 = new Handler2();
     Handler h3 = new Handler3();
     h2.SetSuccessor(h3);
     h1.SetSuccessor(h2);
     foreach(int request in requests)
         h1.HandleRequest(request);
     Console.ReadKey();
 }
예제 #2
0
        static void Main(string[] args)
        {
            int[]   requests = new int[] { 1, 12, 23, 2, 15, 29 };
            Handler h1       = new Handler1();
            Handler h2       = new Handler2();
            Handler h3       = new Handler3();

            h2.SetSuccessor(h3);
            h1.SetSuccessor(h2);
            foreach (int request in requests)
            {
                h1.HandleRequest(request);
            }
            Console.ReadKey();
        }