基本上我听说某些条件会导致.net超越finally块.有谁知道这些条件是什么?
这是在标准C++中实现类似Last的行为的好方法吗?(没有特殊指针)
class Exception : public Exception
{ public: virtual bool isException() { return true; } };
class NoException : public Exception
{ public: bool isException() { return false; } };
Object *myObject = 0;
try
{
// OBJECT CREATION AND PROCESSING
try
{
myObject = new Object();
// Do something with myObject.
}
// EXCEPTION HANDLING
catch (Exception &e)
{
// When there is an excepion, handle or throw,
// else NoException will be thrown.
}
throw NoException();
}
// …Run Code Online (Sandbox Code Playgroud)