S B
S B

Reputation: 8384

Why is QWidget's destructor not virtual?

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

~QWidget();

I was wondering why this is not declared as virtual

Upvotes: 18

Views: 2192

Answers (1)

john
john

Reputation: 87959

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.

Upvotes: 27

Related Questions