Next, we demonstrate a class with several overloaded constructors that enable objects of that class to be conveniently initialized in different ways. To overload constructors, simply provide multiple constructor declarations with different signatures.
By default, instance variables
second of class
Time1 (Fig. 10.1) are initialized to their default values of
0—midnight in universal time. Class
Time1 doesn’t enable the class’s clients to initialize the time with specific nonzero values. Class
Time2 (Fig. 10.5) contains overloaded constructors. In this app, one constructor invokes the other constructor, which in turn calls
SetTime to set ...