#include <iostream> using namespace std; class A { public: A() { cout << "Generator A" << endl; } } a = A(); int main() { cout << "Hello World" << endl; }
全局对象的构造会在main函数之前执行。
时间: 2024-10-13 13:21:05
#include <iostream> using namespace std; class A { public: A() { cout << "Generator A" << endl; } } a = A(); int main() { cout << "Hello World" << endl; }
全局对象的构造会在main函数之前执行。