Qt multiple inheritance and signals

前端 未结 3 523
名媛妹妹
名媛妹妹 2021-02-09 06:38

I\'m having a problem with QT regarding multiple enheritance because of QObject. I know that a lot of others have the same problems but I don\'t know how I should fix it.

<
3条回答
  •  孤城傲影
    2021-02-09 07:26

    Use virtual inheritence, e.g.

    class X : public virtual Y 
    {
    };
    
    class Z : public virtual Y
    {
    };
    
    class A : public virtual X, public virtual Z
    {
    };
    

    will only have one copy of the base class Y

提交回复
热议问题