int main(){
set_terminate(my_thandler);
set_unexpected(my1);
try
{
f();
}
catch(A&)
{
cout<<"caught an A from f"<<endl;
}
catch(B&)
{
cout<<"忽视B类错误"<<endl;
}
警告:MSDN中是这样说的The C++ Standard requires that unexpected is called when a function throws an exception that is not on its throw list. The current implementation does not support this. The following example calls unexpected directly, which then calls theunexpected_handler.