开发者

Why is QWidget's destructor not virtual?

开发者 https://www.devze.com 2023-03-29 11:37 出处:网络
Looking at qwidget.h, I found the destructor as below: ~QWidget(); I was wondering why this is not开发者_如何学运维 declared as virtualThe destructor is virtual, because QWidget derives from QObjec

Looking at qwidget.h, I found the destructor as below:

~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. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消