Figure 9.13 declares Time
object t
(line 9) and reference hourRef
(line 12), which is initialized with the reference returned by the call t.badSetHour(20)
. Line 14 displays the value of the alias hourRef
. This shows how hourRef
breaks the encapsulation of the class—statements in main
should not have access to the private
data in an object ...
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.