Console C++ - Overloading Streams

I don't like streams. Personally, I think that they are a very bad idea.

That said, most C++ courses require the use of streams. Talk about one problem after another - at any rate, I hope this helps.


Overloading Streams

When streams are overloaded to work with classes, they must be declared as friend methods if you want them to have access to private properties. This "example" is based on working code, but has been modifed to be more generic. Basically, it reads a file which has string string integer repeated multiple times. However, several constants and functions are missing and this code will not execute. Maybe, I'll improve it later. Notice that this example uses regular header files (they end in ".h") and not templates. The namespaces associated with templates cause all sorts of additional problems.


Author: Robert Clemenzi - clemenzi@cpcug.org
URL: http:// cpcug.org / user / clemenzi / technical / Languages / Console_C++ / OverloadingStreams.html