This may be a silly question, but here goes. Is there any way I can pass cout as a parameter(by reference of course) into a function that takes an ofstream& as opposed to an ostream&? Basically I have a function that gets an ofstream& as a parameter so that it can continue writing to a pre-defined and pre-opened file. However, I just found the need to also have that function print to the screen. I could make a new function, but it is a fair amount of code and it would be identical. Any ideas?
Would it be a problem to always pass both?
Another question is what is the point of having cin.ignore() after each cin statement. I saw that somewhere and thought I should know.Code:void function(ostream &sout, ofstream &fout);
One more about classes. Is it necessary to always have a destructor, or do the objects get destroyed anyway after going out of scope?
Thanks for the help