您的位置:首页 > 移动开发

What happend: Exception throws in the .ctor()?

2008-06-03 16:12 302 查看
1. If an exception was thrown in a type's .ctor(), then the class's destrutor wouldn't be called.

2. If a exception was catched in a try-catch block, all the well-constructed object will be destructed( destrutor method will be called) before enter the catch section:

try

{

CFoo a;

CFoo b;

throw int();

CFoo c;

}

catch(int& i)

{

//----

}

the destrutor of a, b will be called except c.

3. Any created heap objects will be well-deleted before existing the try block even though an exception occurs.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐