◄CString► ◄Up► ◄Contents► ◄Index► ◄Back► ──Microsoft Foundation Classes────────────────────────────────────────────── friend CString operator +( const CString& string1, const CString& string2 ) throw( CMemoryException ); friend CString operator +( const CString& string, char ch ) throw( CMemoryException ); friend CString operator +( char ch, const CString& string ) throw( CMemoryException ); friend CString operator +( const CString& string, const char* psz ) throw( CMemoryException ); friend CString operator +( const char* psz, const CString& string ) throw( CMemoryException ); 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. You must ensure that the maximum length limit is not exceeded. The Debug version of the Microsoft Foundation Class Library asserts when it detects strings that are too long. 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. Example CString s1( "abc" ); CString s2( "def" ); ASSERT( (s1 + s2 ) == "abcdef" ); CString s3; s3 = CString( "abc" ) + "def" ; // Correct // s3 = "abc" + "def"; // Wrong! One of the arguments must be a CString See Also ◄CString::operator +=► -♦-