【C++】virtual method but non-virtual destructor
本文最后更新于:2022年5月29日 上午
有虚函数(纯虚函数)就应该有虚析构函数。
1 |
|
如果没有虚析构函数,使用该类声明指针,然后在删除该指针的时候会出现下面警告:
1 |
|
解决方法:
在类补充虚析构函数即可消除警告。
【C++】virtual method but non-virtual destructor
https://kevinloongc.github.io/posts/58c3d271.html