释义 |
CString::operator +=
const CString& operator +=( const CString& string ); throw( CMemoryException ); const CString& operator +=( TCHAR ch ); throw( CMemoryException ); const CString& operator +=( LPCTSTR lpsz ); throw( CMemoryException );
参数:string | 将连接到此字符串之后的CString对象。 | ch | 将连接到此字符串之后的一个字符。 | lpsz | 指向将连接到此字符串之后的的字符串的指针。 |
说明: 此+=连接操作符将字符连接到此CString字符串之后。+=操作符可以接受另一个CString对象,一个指向字符的指针或一个字符作为参数。不管你什么时候使用这个连接操作符,都要小心可能出现的内存异常,因为常常要为添加到这个CString对象的字符分配内存。
示例: 下面的例子说明了如何使用CString::operator +=。 // CString::operator +=示例: CString s( "abc" ); ASSERT( ( s += "def" ) == "abcdef" );
请参阅:CString::operator + |