That works if I have
ooint a = "1";
a = a + 1;
but I can't have
ooint a = "1";
ooint b = "2";
a = a + b;
Because of this:
error C2679: binary '+' : no operator defined which takes a right-hand operand of type 'class ooint' (or there is no acceptable conversion)
Wouldn't that mean you have to have another possibility for the operator overload?
Look dude, you have to overload an operator for every type you want to use it with, if you want to do ooint b = a + 1; then you've got to define
Code:
ooint operator + ( const ooint & lhs, int rhs )
If you want to do ooint c = a + b; then you've got to define
Code:
ooint operator + ( const ooint & lhs, const ooint & rhs )
And so on for every type you plan on using for the + operator. Unless C++ has a one step conversion from the type you want to use to the type that + is defined for, you've gotta overload again or it won't work.