4 static unsigned NumAs = 0;
8 A() : ANum(NumAs++) { printf("Created A #%d\n", ANum); }
9 A(const A &a) : ANum(NumAs++) { printf("Copy Created A #%d\n", ANum); }
10 ~A() { printf("Destroyed A #%d\n", ANum); }
13 static bool ShouldThrow = false;
18 if (ShouldThrow) throw 7; return 123;
20 printf("'throws' threw an exception: rethrowing!\n");
30 ~B() { printf("B destructor!\n"); }
37 printf("In B constructor!\n");
40 printf("In B catch block with int %d: auto rethrowing\n", i);
46 B b; // Shouldn't throw.
53 printf("Caught exception!\n");