What is the correct way of Multiple inheritance in Qt/C++?

前端 未结 2 1351
攒了一身酷
攒了一身酷 2020-12-16 16:09

In my Qt application, I have a base class as follow. I am using QObject because I want to use Signal-Slot mechanism in all derived classes.

clas         


        
2条回答
  •  猫巷女王i
    2020-12-16 16:40

    In the current incarnation, it isn't possible to use QObject in multiple inheritance paths for a derived class (like your IRzLayeringPlugin class). The only solution I've ever seen was to create an interface class without any QObject inheritence, but with functions that directly correspond to the QObject functions you want to use, then implement the bridge between the interface and your other QObject class inheritance in your specific class. It gets ugly fairly quickly.

提交回复
热议问题