February 2014
Beginner
1248 pages
62h 25m
English
Consider several issues of class design with respect to class Time1. The instance variables hour, minute and second are each declared private. The actual data representation used within the class is of no concern to the class’s clients. For example, it would be perfectly reasonable for Time1 to represent the time internally as the number of seconds since midnight or the number of minutes and seconds since midnight. Clients could use the same public methods and get the same results without being aware of this. (Exercise 8.5 asks you to represent the time in class Time2 of Fig. 8.5 as the number of seconds since midnight and show that indeed no change is visible to the clients of the class.) ...
Read now
Unlock full access