public static Operation createOperate(string operate) { Operation oper = null; switch (operate) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationMul(); break; case "/": oper = new OperationDiv(); break; default: break; } return(oper); }
public static Operation CreateOperate(string operate) { //根据传入的参数operate选择实例化的类 Operation oper = null; switch (operate) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationMul(); break; case "/": oper = new OperationDiv(); break; } return(oper); }
public static Operation CreateOperate(string operate) { Operation operation = null; switch (operate) { case "+": { operation = new OperationAdd(); break; } case "-": { operation = new OperationSub(); break; } case "*": { operation = new OperationMul(); break; } case "/": { operation = new OperationDiv(); break; } } return(operation); }
public static Operation CreatOperate(string operate) { Operation oper = null; switch (operate) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationMul(); break; case "/": oper = new OperationDiv(); break; default: throw new Exception("input error"); } return(oper); }
public static Operation CreateFactory(string operation) { Operation oper = null; switch (operation) { case "+": { oper = new OperationAdd(); break; } case "-": { oper = new OperationSub(); break; } case "*": { oper = new OperationMul(); break; } case "/": { oper = new OperationDiv(); break; } case "sqr": { oper = new OperationSqr(); break; } case "sqrt": { oper = new OperationSqrt(); break; } case "+/-": { oper = new OperationReverse(); break; } } return(oper); }
public static Operator CreateOperate(string operate) { Operator oper = null; switch (operate) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; } return(oper); }
public static Operation CreateOperation(string op) { Operation oper = null; switch (op) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationMul(); break; case "/": oper = new OperationDiv(); break; } return oper; }
public static Operation createOperate(string operate) { Operation oper = null; switch (operate) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationMul(); break; case "/": oper = new OperationDiv(); break; case "sqr": oper = new OperationSqr(); break; case "sqrt": oper = new OperationSqrt(); break; case "+/-": oper = new OperationReverse(); break; } return(oper); }
public static Operation CreateOperation(String operation) { Operation o = null; switch (operation) { case "+": o = new OperationAdd(); break; case "-": o = new OperationSub(); break; case "*": o = new OperationMul(); break; case "/": o = new OperationDiv(); break; } return(o); }
public static Operation createOperate(string operate) { Operation oper = null; switch (operate) { case "+": oper = new OperationAdd(); break; case "-": oper = new OperationSub(); break; case "*": oper = new OperationMul(); break; case "/": oper = new OperationDiv(); break; case "sqr": oper = new OperationSqr(); break; case "sqrt": oper = new OperationSqrt(); break; case "+/-": oper = new OperationReverse(); break; } return oper; }