// Constructor public CalculatorCommand(Calculator calculator, char @operator, int operand) { this.calculator = calculator; this.@operator = @operator; this.operand = operand; }
private static void Main() { Console.WriteLine($"X is 20 and Y is 10"); var calculator = new Calculator(20, 10); var cmdAdd = new AddCommand(calculator); Console.WriteLine($"Sum is {cmdAdd.Execute()}"); var cmdSub = new SubstractCommand(calculator); Console.WriteLine($"Substract is {cmdSub.Execute()}"); var cmdMul = new MultiplyCommand(calculator); Console.WriteLine($"Multiply is {cmdMul.Execute()}"); }
public User(Calculator calculator) { Calculator = calculator; }
public CalculatorCommand(Calculator calculator, Operation operation, int operand) { _calculator = calculator; _operation = operation; _operand = operand; }
public Add(Calculator calculator) { _calculator = calculator; }