// try_nest.cpp 'throw' from nested function call #include using namespace std; void f1(void); void f2(void); int main(void) { cout << "Staring try_nest.cpp \n"; try { f1(); cout << "should not get here in main \n"; } catch(const int j){ cout << "caught an integer = " << j << '\n'; } cout << "outside the try block \n"; return 0; } // end main void f1(void) { cout << "in f1, calling f2 \n"; f2(); cout << "in f1, returned from f2 \n"; } void f2(void) { cout << "in f2, about to throw an exception \n"; throw 7; }