如果我正在捕捉BaseException
,这也会捕捉到源自 的异常BaseException
吗?异常处理是否关心继承等,还是只匹配被捕获的确切异常类型?
class MyException {
...
};
class MySpecialException : public MyException {
...
};
void test()
{
try {
...
}
catch (MyException &e) {
//will this catch MySpecialException?
}
}