Hours 10 os 0 os timehours timehours if

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ere friend prefix implementation. implementation. Applied Programming ostream& operator<<(ostream& os, const TimeType& time) os const TimeType { // time is output in the form HH:MM:SS if (time.hours < 10) os << '0'; os << time.hours << ':'; << time.hours if (time.minutes < 10) os << '0'; os << time.minutes << ':'; << time.minutes if (time.seconds < 10) os << '0'; os << time.seconds; << time.seconds return os; return os } ostream& operator<<(ostream& os, const TimeType& time) os const TimeType { // time is output in the form HH:MM:SS if (time.hours < 10) os << '0'; os << time.hours << ':'; << time.hours if (time.minutes < 10) os << '0'; os << time.minutes << ':'; << time.minutes if (time.seconds < 10) os << '0'; os << time.seconds; << time.seconds return os; return os } The TimeType iis an argument here so member The TimeType s data is completely specified. data And we return a reference to the stream. Applied Program...
View Full Document

Ask a homework question - tutors are online