... Figs. 9.25–9.27 modifies class Time
’s set functions setTime
, setHour
, setMinute
and setSecond
such that each returns a reference to the Time
object on which it’s called to enable cascaded member-function calls. Notice in Fig. 9.26 that the last statement in the body of each of these member functions returns *this
(lines 21, 33, 45 and 57) into a return type of Time&
.
Get C++ How to Program, 10/e now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.