C w e could also have the function return an error we

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: ant part of Exception C++, but will not be covered here. C++, W e could also have the function return an error We code, so that the calling program can handle the failure of the function. failure Applied Programming bool TimeType::Equals(const TimeType& t) const { return (hours == t.hours return t.hours && minutes == t.minutes && t.minutes && seconds == t.seconds); && t.seconds } bool TimeType::IsBefore(const TimeType& t) const { return (hours < t.hours return t.hours || (hours == t.hours && minutes < t.minutes) || t.hours && t.minutes || (hours == t.hours && minutes == t.minutes || t.hours && t.minutes && seconds < t.seconds)); && t.seconds } Note how we use the second instance of the Note class, t, via "struct-style" reference to the private style" members. members. Applied Programming bool TimeType::Equals(const TimeType& t) const t) const And finally { return (hours == t.hours return t.hours && minutes == t.minutes && t.minutes && seconds == t.seconds); && t.seconds } bool TimeType::IsBefore(const TimeType& t) const t) const void TimeType::Write() const void TimeType::Write { // time is output in the form HH:MM:SS...
View Full Document

Ask a homework question - tutors are online