I really cant understand how I/O operator overloading works behind the scenes
please some1 explain in detail what is really going on, why use return by reference?
> why use return by reference
for chaining. output << "foo " << obj << " bar\n";
when you apply the insert operation to an strem, you modify said stream. So << "foo " would modify `output' and then you need to work with that modified object to send `obj'.
> Because you don't want to copy the output stream
also, you can't copy it.