why do I get an error with this line of code?
string test("a" + "b" + "c");
error C2110: '+' : cannot add two pointers
I have included the string class.
"a" is a pointer to the letter 'a', it is not c++ class std::string. You can only use the + operator on std::string
std::string a = "a"; std::string b = "b"; std::string c = "c"; std::string text = a+b+c;
the reason I asked was because I needed to make a very large string(1000 chars long), and didn't want it all on one line. But then I realized that I can just read it from a file.
We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.