1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream> using namespace std; class A { public: A() { cout << "hello from A" << endl; } ~A() { cout << "by from A" << endl; } }; A a; int main() { cout << "hello from main" << endl; }
1 2 3
hello from A hello from main by from A