Always check for self-assignment.
Always check for self-assignment.
a = a; // make certain this works
const string string::operator = (const string & right)
{ if (this == right) // check for self assignment return right; ...
}
Previous slide
Next slide
Back to first slide
View graphic version