How come operator+=
is defined for std::string
but operator+
is not defined? See my MWE below (http://ideone.com/OWQsJk).
#include <iostream>
#include <string>
using namespace std;
int main() {
string first;
first = "Day";
first += "number";
cout << "\nfirst = " << first << endl;
string second;
//second = "abc" + "def"; // This won't compile
cout << "\nsecond = " << second << endl;
return 0;
}