C++ Exception Throw string value as exception
#include <iostream> using namespace std; void Inner()// ww w . j a v a2 s. c om { throw string("Error!"); } void Outer() { try { Inner(); } catch (string excep) { cout << "Outer caught an exception: "; cout << excep << endl; throw; } } int main() { try { Outer(); } catch (string excep) { cout << "main caught an exception: "; cout << excep << endl; } return 0; }