Non-virtual destructor in QNetworkAccessManager
I’m subclassing QNetworkAccessManager to provide for a custom protocol as per http://doc.trolltech.com/qq/32/qq32-webkit-protocols.html and I see that the destructor for QNetworkAccessManager is non-virutal(http://doc.qt.nokia.com/4.7-snapshot/qnetworkaccessmanager.html#dtor.QNetworkAccessManager).
I can see that this will not work if do not set a parent for the object and hold a reference to it as a QNetworkAccessManager.
Will the object be destroyed properly if I set a parent to it? Does QObject’s destructor handle children with non-virtual destructors properly?
QNetworkAccessManager inherits from QObject. The latter has marked it’s destructor as virtual, so subsequently the destructors of all derived classes are virtual too.
See FAQ 20.7 [parashift.com] of the C++ FAQ for an explanation.
The object will be destroyed properly when it has a parent.