class String
{
String();
friend String operator+ (const
String&, const String&);
};
String operator+ ( const String &lhs, const &rhs )
{
int totalLen = lhs.GetLen() +
rhs.GetLen();
String temp(totalLen);
for ( int i=0;
i<lhs.GetLen(); i++ )
temp[i] = lhs[i];
for ( int j=0;
j<rhs.GetLen(); j++, i++ )
temp[i] = rhs[j];
temp[totalLen] = ‘\0’;
return temp:
}