#include <iostream>
struct Foo
{
Foo() { printf("before main()/n"); }
~Foo() { printf("after main()/n"); }
};
Foo smallFoo;
int main(int argc, char* argv[])
{
std::cout << "Hello, world !/n";
return 0;
}
全局对象在“程序开始时”建立一次,在“程序终止时”销毁一次
最新推荐文章于 2022-03-29 13:23:56 发布