I'm reading chapter 16 so that I may begin my assignments for my C++ class. This section is on exception handling. I understand the concept behind a try / catch construct, however, one of the examples in the book is a bit confusing to me. I'm hoping for some explanation as to how this is working. The sample code is below:
// Includes, header guards, and namespace std...
class IntRange
{
 private:
  int intput;
  int lower;
  int upper;
 public: 
  // Exception class
  class OutOfRange { }; // This is exactly how it appears in the text.
  IntRange(int low, int high) { lower = low; upper = high; }
  int GetInput()
  {
    cin >> input;
    if (input < lower || input > upper)
      throw OutOfRange(); // <-- This is my question in particular. What is this?
    return input;
  }
};
// End header guard.
// Program entry point.
int main()
{
  IntRange range(5, 10)
  int userValue;
  cout << "Enter a value in the range 5 - 10: ";
  try
  {
    userValue = range.getInput();
    cout << "You entered " << userValue << endl;
  }
  catch (IntRange::OutOfRange) // <-- Again, what is this delcaration and how can
                               // this data type be defined when IntRange does not
                               // have a default constructor?
  {
    cout << "That value is out of range.\n";
  }
  return 0;
}
The code is exactly as it appears in the textbook, except I put some stuff on the same line in order to keep the question from becomming really long.
If you notice any errors, it's most likely a typo, but the most important points have been double-checked.
 
     
     
     
    