H file put it inside of class put class time friend

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: erator<<(ostream & out, const Time & t) { …… } 2/16/2011 12 4 2. Friend Functions In In order to use private data members in the external functions, like use myHours, myMinutes in function myHours, operator<<() operator<<() You You can specify this function operator<<() as a operator<<() "friend" function friend" Thus Thus given "permission" to access private data elements Declaration Declaration in .h file (put it inside of class !!!) (put class Time{ friend ostream & operator<<( ostream & out, const Time & t); public: … } 2/16/2011 13 Friend Functions Definition Definition in .cpp file ostream & ope...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online