Suppose I have this class:
class Int{
private:
int x;
public:
Int(int i) : x(i) {}
};
Can I build a prefix + operator to write expression such x = + a b?
I tried to overload operator+ inside the class but the compiler complain that operator+ must be unary or binary and not ternary.
Is there a way to do such thing?
No you can't change the basic syntax of the expression.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With