So, Should I use this part to switch with my old
Code:
Integer& Interger::operator=( const Interger& rhInt)
{
value = rhInt.value;
return *this;
}
to that one
Code:
// call new before calling delete (safe for self assignment)
Integer& Integer::operator=( const Integer& rhInt ) {
// do not dereference a null pointer, consider a null pointer
// to be a deep copy of a null pointer.
int *new_int = rhInt.value?new(*(rhInt.value)):0;
delete value;
value = new_int;
return *this;
but. what is it?
Code:
int *new_int = rhInt.value?new(*(rhInt.value)):0;