<div>i have a question. Can i pass an output file by reference to a different class.
I have a main class where i declare my output file. Now i want to pass it to my hash class but by refernce so that the hash class can pass it to the node class and the node class can pass it to the bucket class and then anytime in any class that i need to print
something i can just use the output file. I can only 'open' the output file once for writing. I want to open it once in main and then pass it by reference to the other classes. Thanks!</div>
mindboglr
Member
5 Points
1 Post
c++ quesetion
May 04, 2005 03:07 PM|LINK
I have a main class where i declare my output file. Now i want to pass it to my hash class but by refernce so that the hash class can pass it to the node class and the node class can pass it to the bucket class and then anytime in any class that i need to print something i can just use the output file. I can only 'open' the output file once for writing. I want to open it once in main and then pass it by reference to the other classes. Thanks!</div>
jknack
Contributor
3668 Points
760 Posts
Re: c++ quesetion
Jun 23, 2005 04:13 PM|LINK
ofstream &myFun(ofstream &myOutput)
{
myOutput << "This value will be written to the file that I have opened in the main program."
}