Using operator+ without leaking memory?
- by xokmzxoo
So the code in question is this:
const String String::operator+ (const String& rhs)  
{  
    String tmp;  
    tmp.Set(this->mString);  
    tmp.Append(rhs.mString);  
    return tmp;  
}  
This of course places the String on the stack and it gets removed and returns garbage.
And placing it on the heap would leak memory. So how should I do this?