I've the following classes:
class Person
{
...
std::string personToString()
{
return "First Name: " + pFirstName + "\nLast Name: " + pLastName +
"\nID Type: " + determineIdType() + "\nID Number: " + std::to_string(pIdNumber) +
"\nBirth Date: " + pBirthDate + "\nBiological Sex: " + determineBiologicalSex() +
"\nPhone Number: " + pPhoneNumber;
}
};
class Patient : Person
{
...
std::string patientToString()
{
return "Patient's Data: " + "\n" + personToString() +
"\nHealth Insurance: " + determineHealthInsurance();
}
};
When compiling, I get the following error:
error: invalid operands of types 'const char [17]' and 'const char [2]' to binary 'operator+'
What is my mistake here? This works in Java, I'm not sure why it doesn't on C++ (the concatenation of strings)
Thanks