... because the constructor arguments are out of range.

Fig. 9.7 Constructor with default arguments.

Alternate View

 1   // Fig. 9.7: fig09_07.cpp
 2   // Constructor with default arguments.
 3   #include <iostream>
 4   #include <stdexcept>
 5   #include "Time.h" // include definition of class Time from Time.h 
 6   using namespace std;
 7
 8   // displays a Time in 24-hour and 12-hour formats
 9   void displayTime(const string& message, const Time& time) {
10      cout << message << "\nUniversal time: " << time.toUniversalString()
11         << "\nStandard time: " << time.toStandardString() << "\n\n";
12   }
13
14   int main() {
15      Time t1; // all arguments defaulted                            
16      Time t2{ ...

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.