社区
C++ 语言
帖子详情
has virtual functions but non-virtual destructor?
guofengzai
2008-04-15 11:27:00
warning: `class LinearList<int>' has virtual functions but non-virtual destructor
这是什么警告啊,怎样去除?
...全文
1045
4
打赏
收藏
has virtual functions but non-virtual destructor?
warning: `class LinearList' has virtual functions but non-virtual destructor 这是什么警告啊,怎样去除?
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
yczala
2008-07-07
打赏
举报
回复
不是可以自动生成析构函数吗?
daohua
2008-04-16
打赏
举报
回复
[Quote=引用 1 楼 Thorwein 的回复:]
没有析构。
[/Quote]
lzr001
2008-04-15
打赏
举报
回复
析构函数增加virtual
Thorwein
2008-04-15
打赏
举报
回复
没有析构。
相关推荐
Android12之oboe报错: has
virtual
function
s but
non
-
virtual
destructor
Android12之oboe报错: has
virtual
function
s but
non
-
virtual
destructor
delete called on
non
-final ‘xxx‘ that has
virtual
function
s but
non
-
virtual
destructor
Qt中遇到如下警告 warning: delete called on
non
-final 'xxx' that has
virtual
function
s but
non
-
virtual
destructor
因为类中有纯虚函数。 只要纯虚函数, 就必须要虚析构函数。 所以解决办法就是在原类中定义虚析构函数。 ...
-W
non
-
virtual
-dtor持有虚函数却不是虚析构
-W
non
-
virtual
-dtor (C++ and Objective-C++ only) Warn when a class has
virtual
function
s and an accessible
non
-
virtual
destructor
itself or in an accessible polymorphic base class, in which case it is possible but unsafe to delete an instance of a derived c
has
virtual
function
s but
non
-
virtual
destructor
#include <iostream> using namespace std; class based{ public: based(){ } ~based(){ cout<<"flag 1"<<endl; }
virtual
void f(){ cout<<"ok1"<<endl;
Virtual
Destructor
Deleting a derived class object using a pointer to a base class that has a
non
-
virtual
destructor
results in undefined behavior. To correct this situation, the base class should be defined w...
发帖
C++ 语言
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
6.3w+
社区成员
25.0w+
社区内容
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
帖子事件
创建了帖子
2008-04-15 11:27
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下