Hi,
Can any body throw any light as to why ifCode:class X { int i; public: X(const int& val) : i(val) {} X operator+(const X&); }; X X::operator+(const X &ob) { return X(i + ob.i); } int main() { X ob1(10), ob2; ob1 + 30; // this works like ob1 + X(30); 30 + ob1; // NOT working in VC++. Any idea why??? return 0; }
ob1 + 30 works why not 30 + ob1
thanks in advance,