Hi all,
Long story short, in school we've made functions with prototypes such as:
void printData(ostream& object = cout);
The purpose is to print something to the console by default, but if an ofstream object is passed, the data will be written to a file. Works well.
So I would say, cout and ofstream are members of the same group: ostream. (which is then part of ios). How would I make the equivalent level of object as ostream for myself? Perhaps a guide I could be linked to?
Thanks
Edit: My question still stands, but I guess it will just rasise a lot more questions for me.
Long Story: I have a class "Directory". In this directory there are 15 sections, and each section is it's own class. Each section may have more than one entry (hundreds even), so I create the amount of sections dynamically. So, I have a bunch of functions:
1 2 3
|
directory.printData01(Section01& sec01[i]);
directory.printData02(Section02& sec02[i]);
...
|
What direction should I take to try to make those section classes/objects part of the same group? Perhaps end up with something like:
directoryPrintData(section Section02, int i);