Something like
string eval(operand1, operand2, operator) { ... } ?
Basically, you could have different eval methods for different operand
types, such as:
string eval(int1, int2, operator) {}
string eval(double1, double2, operator) {}
....
Of course you could also use a function that simply takes object arguments:
string eval(object1, object2, operator) {...}
Within that particular method you could then simply check for the actual
type of the arguments (using GetType()) and proceed accordingly.
The operator would be a value representing any one of the opertors you would
like to support, such as "+", "-", "/", etc.
In the method body you then require a switch statement in which you check
for the actual operator and perform the appropriate operation with the
operands. You would then return a string representation of the result as the
result of the Eval() function.
Does that get you started?
Regards,
Alex