#include <iostream>
#include <fstream>
#include <cstdio>
using namespace std;
class Derived
{
public:
Derived()
{
cout<< "Initialize...\n";
}
~Derived()
{
cout<< "Finalize...\n";
}
};
static Derived *obj=new Derived();
int main()
{
cout<<"Main Started::\n";
}
我正在尝试将输出设为: Initialize MainStarted Finalize
但是得到: 初始化 MainStarted
我试图调试,但它没有进入析构函数。所以我无法解决这个问题。