, g++ (MinGW 4.4.1) MSCV ++ 10 , .
, myObj, - , , ...
, , , +, + = = .
myObj & myObj::operator+(myObj & mO)
{
myObj retO = myObj(mO);
retO += *this;
return retO;
}
+ myObj ( ) * this mO ( retO) retO, .
g++ :
myObj2 = myObj1 + myObj2;
Visual Studio 10.0 retO, , - ( ).
, . , MinGW , MSV++ 10 .
Of course, the problem with creating a new myObj object with a new keyword is a memory leak, because the above construction does not support a link to a new instance of myObj that is allocated by myObj2.
Hi,
By the look
source
share