const newString& newString::operator=(const newString& rightStr)
{
if(this!=&rightStr)
{
delete[] strPtr;
strLength=rightStr.strLength;
strPtr = newChar[strLength+1];
strcpy(strPtr,rightStr.strPtr);
}
return* this;
}
I know it avoids self copy, but what does "this" keyword refer to? I mean I thought it was rightStr but then why would it chechk if its equal to itself?