title: Exception in Destructor C++
body: <p>I am well aware of the fact that one should not throw any exception in destructor.</p>
  
  <p>But as a part of making my grip on this concept,I coded this example :-</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class A {
  private: 
      int i;
  
  public:
      A()
      {
          i = 10;
      }
      ~A()
      {
          throw 30;
      }
  };
  int main(){
      try{
          A();
          throw 10;
      }
      catch (int i){
          cout &lt;&lt; i &lt;&lt; endl;
          cout &lt;&lt; "exception caught" &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>As per my understanding, this program should be terminated by calling std::terminate() as there will be two exceptions at the same time. But, this program is giving the following output:-</p>
  
  <pre><code>30
  exception caught
  </code></pre>
  
  <p>Can anyone please explain me the logic behind this as to why this is not terminating?</p>