例如有函数
void A()
{
……
throw new CFileException();
……
}
在函数B中调用A
bool B
{
try
{
……
A();
}
catch(CFileException e)
{
some handling
}
……
}为什么我发现在B中捕捉不到从A抛出的异常?
请教
void A()
{
……
throw new CFileException();
……
}
在函数B中调用A
bool B
{
try
{
……
A();
}
catch(CFileException e)
{
some handling
}
……
}为什么我发现在B中捕捉不到从A抛出的异常?
请教
2、你的处理方式有问题:异常对象从堆中分配,但是直接捕获异常对象,而不是通过指针,则必然存在内存泄漏,而且好多了一次的拷贝构造函数的消耗。