示例#1
0
        private static void ChainOfResponsibilityDemo()
        {
            Approver larry = new DesignPatterns.ChainOfResponsibility.Director();
            Approver sam   = new VicePresident();
            Approver tammy = new DesignPatterns.ChainOfResponsibility.President();

            larry.SetSuccessor(sam);
            sam.SetSuccessor(tammy);

            // Generate and process purchase requests

            Purchase p = new Purchase(2034, 350.00, "Assets");

            larry.ProcessRequest(p);

            p = new Purchase(2035, 32590.10, "Project X");
            larry.ProcessRequest(p);

            p = new Purchase(2036, 122100.00, "Project Y");
            larry.ProcessRequest(p);
        }