同じブロックで例外がスローされる前に try ブロックに cout ステートメントが含まれている場合、それらのステートメントはコンソールに出力されますか、それとも、try ブロックが実行されなかったかのように動作しますか? 例えば:
void foo()
{
try
{
cout << "1" << endl;
cout << "2" << endl;
bar(); //exception thrown in this function, but caught below
}
catch (exception e)
{
cout << e.what(); //assume the message is "error"
}
}
この関数の出力は
1
2
error
また
error