I have created an IString class that wraps around stl string. When I test my classes + operator this is what I get:
output: sEdc =Freddy Flinty''
IString sEdc= "Freddy Flinty";
sEdc = "'" + sEdc + "'";
cout<< "sEdc =" << sEdc<<endl;
expected output: sEdc ='Freddy Flinty'
Here is my operator definition
Any ideas on what I am doing wrong?
//buffer is the stl string private data member defined in the header file
IString IString::operator + ( const IString &aString ) const
IString result(buffer, aString);
IString IString::operator + ( const char *pString ) const
IString result(buffer, pString);
IString operator + ( const char *pString, const IString &aString )
IString result(aString.buffer, pString);
IString::IString(string str, const char* pString)
buffer = str; //buffer is an stl string
buffer += pString;