zoukankan      html  css  js  c++  java
  • What happend: Exception throws in the .ctor()?

    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.

  • 相关阅读:
    内置函数详解
    lambda函数
    第八章(5)
    第八章(4)
    第八章(3)
    第八章(2)
    第八章(1)
    第七章(3)
    第七章(2)
    第七章(1)
  • 原文地址:https://www.cnblogs.com/puncha/p/3877006.html
Copyright © 2011-2022 走看看