I am working with a class that is mostly working fine, but I am doing some functionality that I might be having a recursive function return a NULL
pointer of the class type as a control, and so it might be assigning a NULL
pointer to my class object so long story short:
Thing& Thing::operator=(Thing * _other){
if (_other == NULL){
*this = NULL; // compiler throws here
return *this;
}
// does other assignment work
return *this;
}
my compiler VS2010 throws that this
is not an I-value. so how do I set the value to NULL
, or is it even possible to set an item to NULL from inside?
EDIT: modified this
to *this
though for some reason now the program breaks with infinite calls to the assignment operator. no idea what is going on