This program is just being used to test exceptions..It should throw exceptions until the value falls within the given range (here it is between 1 and 11).. Doesnt have any real functionality, other than that.. It catches and handles the exception the first time through (using an input value of 11, which is "out of range" for this situation.. anyway if i input 12 the second time subRange is called (out of the catch statement), i get an error message "unhandled exception: int @ some memory address", instead of the generic "E" being thrown and being caught again in main.. i have a suspicion that it has something to do with the stack.. if anyone could explain the "why" behind this, i would appreciate it..
using namespace std;
int getValue( );
subRange::subRange(int low, int high)
lower = low;
upper = high;
int E = 1;
cout << "Enter value [ " << lower << ", " << upper << " ]: ";
cin >> v;
if(v < lower || v > upper)
throw E; //unhandled error here after second call..
subRange x(1, 10);
cout << "\nValue out of Range! \n";
cout << x.getValue() << endl;