Provides this is just isbefore with the more

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: by We const TimeType TimeType::operator+ const TimeType (const TimeType& r_op) const (const TimeType r_op { TimeType temp = r_op; temp r_op && seconds < r_op.seconds)); && r_op.seconds } // temp.hours += hours; temp.minutes += minutes; temp.seconds += seconds; code here to make values within range return temp; } provides the operator <. provides This is just IsBefore() with the more meaningful This IsBefore with r_op iinstead of t. r_op nstead Applied Programming W e can also provide + by We const TimeType TimeType::operator+ const TimeType (const TimeType& r_op) const (const TimeType r_op { TimeType temp = r_op; temp r_op // temp.hours += hours; temp.minutes += minutes; temp.seconds += seconds; code here to make values within range return temp; Applied Programming The operator we just provided will add two The TimeTypes together. TimeType W hat about adding an integer number of seconds What to a time? to Another operator!! Another +!!! Another } W hoops - we need an assignment operator. Whoops (No. This is just initialisation....
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online