Class Help

This is a discussion on Class Help within the C++ Programming forums, part of the General Programming Boards category; Can anyone tell me why I get the following errors, it is complaing about accessing a private variable for a ...

Here yah go...

here yah go mate..

Code:

friend void display( ostream & out, const Time & obj );

where u have const it is telling the compiler not to change any of the private data members of Time class.....
doesn't appear that you are doing that.. but it appears ostream is trying to do stuff to hours, mins, and seconds...

so an easy solution appears to be to use this code..

Code:

friend void display( ostream & out, Time & obj );

well by golly.. i believe i have helped two people today... my good deeds for the year have been completed... i should be given an award or something... (cash is also acceptable..)

Well Hey that worked, it was actually just an example my teacher gave us, I just wanted to see if it actually worked.... Everything seemed logical, but now I definately have a better understanding of what was going on....