... 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.