throw *
有下面两个类:
class base
{};
class sub : public base
{};
下面的异常代码:
try
{
base *bb = new sub();
throw(bb);
}
catch (sub*)
{
std::cout<<”this handler won’t execute”;
}
catch (base*)
{
std::cout<<”exxcute this handler”<<std::endl;
}
因此,最好不要throw指针类型的异常。