when i overload the assignment operator the destructor of the temporary object still gets called.
if i change the data member of the assigning ( right hand ) object to a specific invalid value during the assignment and have the destructor check for this value before deallocating it works for the temporary object in this way:
Code:
A objA(1);
objA = A(2);
but it doesn't work in this case:
Code:
A objA(1);
A objNewA(2);
objA = objNewA; // objNewA will have the invalid value
from an assignment you would only expect a copy to be made. or is that something that i would then have to accept?