My class structure is similar:
class MethodHelper : public QObject, public IMethodHelper { public:
Now I get a pointer to the object:
QObject* someObject = getMethodHelper();
Here I am very sure that someObject is a MethodHelper type. I somehow want to drop it in IMethodHelper. How can I do it?
My current thoughts are similar to QObject -> MethodHelper -> IMethodHelper , for example:
QObject* someObject = getMethodHelper(); MethodHelper* myHelper = qobject_cast<MethodHelper*>(someObject); IMethodHelper* myIHelper = dynamic_cast<IMethodHelper*>(myHelper);
is there a potential flaw in my approach?
source share