You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
343 B
C++

#include <cstdio>
struct A {
A() { puts("A()"); }
~A() { puts("~A()"); }
};
struct B {
B() { puts("B()"); }
~B() { puts("~B()"); }
};
struct C {
A a;
B b;
C() { puts("C()"); }
~C() { puts("~C()"); }
};
int main() {
C c;
// Destructors should be called in exactly the opposite order of the
// constructor calls.
}