overloaded string concatenation operator with C-style string : string concatenation « string « C++ Tutorial






#include <iostream>
using std::cout;
using std::endl;

#include <string>
using std::string;

int main()
{
   string s1( "AA" );
   string s2( " AAB" );
   string s3;

   // 
   cout << "\n\ns1 += \" to you\" yields" << endl;
   s1 += " to you";  
   cout << "s1 = " << s1 << "\n\n";
   return 0;
}
s1 += " to you" yields
s1 = AA to you








15.8.string concatenation
15.8.1.overloaded string concatenation operator
15.8.2.Plus string together
15.8.3.Concatenate two strings
15.8.4.overloaded string concatenation operator with C-style string