示例#1
0
 public void Calculate(Numbers numbers)
 {
     if (numbers.GetOperation() == "*")
     {
         Console.WriteLine("Result: " + (numbers.GetNumber1() * numbers.GetNumber2()));
     }
     else
     {
         Console.WriteLine("Error occured");
     }
 }
示例#2
0
 public void Calculate(Numbers numbers)
 {
     if (numbers.GetOperation() == "-")
     {
         Console.WriteLine("Result: " + (numbers.GetNumber1() - numbers.GetNumber2()));
     }
     else
     {
         nextInChain.Calculate(numbers);
     }
 }