I'm trying to understand the underlying process in C++ that allows us to form the following expression in C++:
cout << "Hello," << "World" << a + b;
From my understanding, first, the insertion operator takes the ostream object cout
and the string literal "Hello"
as operands and the expression returns a type of cout
and thus cout
is now the type of the next string literal and finally also the type of the expression a + b
.
I'm having trouble understanding the technical details of this process, I understand references are involved which allow us to do this ?