CString::operator +
friendCStringoperator+(constCString&string1,constCString&string2);
throw(CMemoryException);
friendCStringoperator+(constCString&string,TCHARch**);**
throw(CMemoryException);
friendCStringoperator+(TCHARch**,constCString&string);**
throw(CMemoryException);
friendCStringoperator+(constCString&string,LPCTSTRlpsz**);**
throw(CMemoryException);
friendCStringoperator+(LPCTSTRlpsz**,constCString&string);**
throw(CMemoryException);
Return Value
A CString object that is the temporary result of the concatenation. This return value makes it possible to combine several concatenations in the same expression.
Parameters
string, string1, string2
CString objects to concatenate.
ch
A character to concatenate to a string or to concatenate a string to.
lpsz
A pointer to a null-terminated character string.
Remarks
The + concatenation operator joins two strings and returns a CString object. One of the two argument strings must be a CString object. The other can be a character pointer or a character. You should be aware that memory exceptions may occur whenever you use the concatenation operator since new storage may be allocated to hold temporary data.
Example
The following example demonstrates the use of CString::operator +.
// example for CString::operator +
CString s1( "abc" );
CString s2( "def" );
ASSERT( (s1 + s2 ) == "abcdef" );
CString s3;
s3 = CString( "abc" ) + "def" ; // Correct
s3 = "abc" + "def";
// Wrong! The first argument must be a CString.
CString Overview | Class Members | Hierarchy Chart
See Also CString::operator +=