How can I overload the left shift operator for strings, can someone help me? :
const char*
{
int operator<<(const char* rhs)
{
return std::atoi(this) + std::atoi(rhs);
}
}
int main() {
const char* term1 = "12";
const char* term2 = "23";
std::cout << (term1 << term2);
}
(above code does not compile)
Expected output: 35
atoi
is crap. Does to check for errors