Use overloaded string concatenation operator - C++ STL

C++ examples for STL:string

Description

Use overloaded string concatenation operator

Demo Code

#include <iostream> 
#include <string> 
using namespace std; 

int main() /*ww  w .j av a 2  s.  co m*/
{ 
    string s1( "happy" ); 
    string s2( " birthday" ); 
    string s3; 

   
   cout << "\n\ns1 += s2 yields s1 = "; 
   s1 += s2; // test overloaded concatenation 
   cout << s1; 
}

Result


Related Tutorials