---------------
Christof.Meerwald@ freec++.prog

home
> prog
>> freecpp
>>> throwing destructor

translate to German (by SYSTRAN)

Throwing Destructor

See Throwing Destructors.

> throwing_destructor.cpp:

int dtor_ctr = 0;

struct A
{
  ~A()
  {
    dtor_ctr++;
  }
};

struct B : A
{
  A a;

  ~B()
  {
    throw 0;
  }
};


int main()
{
  try
  {
    B b;
  }
  catch (const int &)
  {
  }

  return !(dtor_ctr == 2);
}
---------------

This Web page is licensed under the Creative Commons Attribution - NonCommercial - Share Alike License. Any use is subject to the Privacy Policy.

Revision: 1.2, cmeerw.org/prog/freecpp/throwing_destructor.html
Last modified: Mon Sep 03 18:20:50 2018
Christof Meerwald <cmeerw@cmeerw.org>
XMPP: cmeerw@cmeerw.org