I’ve just came across this example:
Scroll down to the bottom of the page, where you will find
QWidget *pw = static_cast<QWidget *>(parent);
Parent is of type: QObject, which is the Base class of QWidget, so in this case, isnt:
dynamic_cast should be used?
such as:
QWidget *pw = dynamic_cast<QWidget*>(parent)
Thanks,
If you know that you are down-casting from a base to a descendant class (i.e., you know the object is actually an instance of the descendant class), then static_cast is perfectly legal (and more performant).