#include <iostream>#include <stdlib.h>using namespace std;class A {public:A() {cout << "I come here before main()!" << endl;f();}static void f() {cout << "I come here before main() too!" << endl;}};static A a;int main(int argc, char *argv[]){cout << "Entering main()!" << endl;cout << "Leaving main()!" << endl;system("PAUSE");return 0;}运行结果如下: