1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream> #include <iomanip> using namespace std; struct S{ ~S(){ cout << "goodbye cruel world!" << endl; } }; int main() { S destroy_me; destroy_me.~S(); cout << "end of main" << endl; }
1 2 3
goodbye cruel world! end of main goodbye cruel world!