找到你要的答案

Q:Before Virtual destructor concept, all programs had memory leak?

Q:在虚析构函数的概念,所有的程序有内存泄漏?

I was thinking when there was no concept of virtual destructor then all programs developed during that time had memory leak issues or they were using other concept to avoid memory leak?

我想当没有虚析构函数然后所有程序开发的概念,在这期间发生了内存泄漏问题,或者他们用其他概念来避免内存泄漏?

answer1: 回答1:

No, in general past programs without virtual destructor did not have memory leaks. Talking on C++ virtual destructors were invented at about the same time as other virtual functions and inherritance mechanics so it was somewhat diesigned with virtual destructors builtin.

Those desctructors needed and explicit virtual keyword though.

不,在过去的项目一般没有虚析构函数没有内存泄漏。浅谈C++虚函数的发明在时间像其他虚函数和inherritance力学一样,这有点diesigned虚拟析构函数内置。

那些desctructors需要明确虚拟关键词虽然。

c++11  virtual  destructor