Beispiel #1
0
 public override void HandleExpence(Expence expence)
 {
     if (expence.Amount > 1000)
     {
         Console.WriteLine("President handle it.");
     }
 }
Beispiel #2
0
 public override void HandleExpence(Expence expence)
 {
     if (expence.Amount > 100 && expence.Amount <= 1000)
     {
         Console.WriteLine("Vice President handle it.");
     }
     else if (Successor != null)
     {
         Successor.HandleExpence(expence);
     }
 }
Beispiel #3
0
 public override void HandleExpence(Expence expence)
 {
     if (expence.Amount <= 100)
     {
         Console.WriteLine("Manager handle it.");
     }
     else if (Successor != null)
     {
         Successor.HandleExpence(expence);
     }
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            Manager       manager       = new Manager();
            VicePresident vicePresident = new VicePresident();
            President     president     = new President();

            manager.SetSuccesor(vicePresident);
            vicePresident.SetSuccesor(president);

            Expence expence = new Expence();

            expence.Amount = 198;
            manager.HandleExpence(expence);

            Console.ReadKey();
        }
Beispiel #5
0
 public abstract void HandleExpence(Expence expence);