First page Back Continue Last page Graphics
operator<< ( )
void operator<< (ostream & os, const Time & t);
{
os << t.hours << “ hours, “
<< t.minutes << “ minutes”;
}
The function accesses individual members of the Time object, but doesn't access individual members of the ostream class. So, it must be a friend to Time, but not to ostream.
Practice: mytime3 (note: mytime3.h)