大家看看这是什么原因
#include <iostream>
class World
{
public:
World () { std::cout << "Hello!\n"; }
~World () { std::cout << "Goodbye!\n"; }
};
int main () {World TheWorld;}
结果是:Hello!
Goodbye!
#include <iostream>
class World
{
public:
World () { std::cout << "Hello!\n"; }
~World () { std::cout << "Goodbye!\n"; }
};
World TheWorld;
int main () {}
结果是:Hello!
咋没有 Goodbye!呢?