| <<< | Index | >>> |
Because this is a pointer to the current object, *this refers to the object itself.
Sometimes we want a member function to return a reference to the object it was called on.
String s1;
String s2;
String s3;
s1.append( s2 ).append( s3 );
|
String& String::append( String& other )
{
// ...
return *this; // "return myself"
}
|
| <<< | Index | >>> |