[英]Why is QWidget's destructor not virtual?
Looking at qwidget.h, I found the destructor as below: 看看qwidget.h,我发现了析构函数如下:
~QWidget();
I was wondering why this is not declared as virtual 我想知道为什么这不是虚拟的
The destructor is virtual, because QWidget derives from QObject which does have a virtual destructor. 析构函数是虚拟的,因为QWidget派生自QObject,它具有虚拟析构函数。 Why it's not declared virtual in the code is a either style issue or a harmless mistake.
为什么它没有在代码中声明为虚拟,无论是样式问题还是无害的错误。 I would have declared it virtual myself.
我会自己宣布它是虚拟的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.