catch (...)
表示捕获所有类型的异常。这意味着无论抛出的是何种类型的异常,这个 catch 块都会尝试捕获并处理它。
int main() {
try{
//do some thing
}catch(const exception &e){
cout<<e.what()<<endl;
}catch(...){
// 无论那种异常这里都会打印
cout<<"error in xxx"<<endl;
}
}