i'm having a little trouble grasping the concept of this. If someone could help it would be great.

Its part of my assignment...no i don't want u to do it for i just need help.

1. declare an ofstream foutput in main function
2. open a file in main function
3. call the member function to pass foutput to fout
4. close foutput in main function

heres the format we have to use

void Worker:: printOut(ofstream & fout)
{ 
fout << ....
}

i understand 1,2,and 4 but i don't understand what (ofstream & fout) is doing or how to pass foutput to fout.

That question is very poorly worded. As far as I can tell, it basically means do this:

ofstream foutput ( "somefile" );
Worker w;

w.printOut ( foutput );

By the way, if printOut doesn't use any member functions specific to ofstream, you could make it more general by having it accept a reference to ostream rather than ofstream:

void Worker::printOut ( ostream& out );

Or if you're feeling really ambitious, you could generalize it for all character types too (you don't need to understand this yet):

template <typename T, typename Traits>
void Worker::printOut ( basic_ostream<T, Traits>& out );

>1. declare an ofstream foutput in main function
>2. open a file in main function
These are nice because you can merge them together. When you declare an ofstream object, just call the constructor at the same time with the file name and it will open it.

>4. close foutput in main function
The nice thing about this is that you don't have to do anything. :) Any standard stream objects that you open will be implicitly closed in the destructor, so there's no need to call the close member function explicitly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.