【发布时间】:2016-04-18 11:25:06
【问题描述】:
我正在从 MFC CDialogEx 派生一个类:
class MyDialog : public CDialogEx
{
public:
virtual void PostNcDestroy();
…
…
};
我实现了PostNcDestroyas such:
void MyDialog::PostNcDestroy()
{
CDialogEx::PostNcDestroy();
delete *this; // oops, typo
}
我很惊讶地看到这段代码可以编译(使用 VC120 或 Visual Studio 2013),并且根本不会产生任何警告。谁能说出为什么会这样?
谢谢。
【问题讨论】:
标签: c++ compilation mfc