I'm not really sure what's happening here. Its obvious why the inner catch catches throw 2, but why does the outher catch(int x) catch throw? I thought catch(int x) is supposed to catch integer values only. Is it possible that the second throw throws what was first cought (which is 2)?
try
{
try
{
throw 2;
}
catch (int n)
{
std::cout << "Inner Catch " << n << std::endl;
throw;
}
}
catch (int x)
{
std::cout << "Outer Catch " << x << std::endl;
}
Thanks!