A final version would require error checking should

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: ming Now we don't need the Write() member Now Write() member function (although << could call it). << Applied Programming OK. We're on a roll. Let's try input. We'll have a function like We can just say friend istream& operator>>(istream&, type&); friend istream TimeType t(10,20,30); cout << "The time is " << t << endl; << endl for each built-in. and get What does it have to do? The time is 10:20:30 Convert text characters to the type. Applied Programming Suppose we want to input TimeType iin exactly Suppose TimeType n the same way as we are outputting them – three three integers separated by : integers istream& operator>>(istream& is, TimeType& time) { char temp; Of course, this assumes that input is correct. A final version would require error checking. Should an error occur, error flags should be Should turned on and the stream should not be returned – just as...
View Full Document

Ask a homework question - tutors are online