[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: C++ help, please...
From:       "Tomas Mecir" <mecirt () gmail ! com>
Date:       2006-05-30 12:05:00
Message-ID: 492258b10605300505k28f953c9q2691e75957cdb74b () mail ! gmail ! com
[Download RAW message or body]

On 5/29/06, Thomas Zander <zander@kde.org> wrote:
> In KWord I have a KWCanvas which implements both:
> class KWCanvas : public QWidget, public KoCanvasBase
>
> I instantiate it and then pass it to the setCanvas call.  (done in the
> KWGUI class) Obviously I need to downcast it either to QWidget or to
> KoCanvasBase.
>
> In the setCanvas method I then do a dynamic_cast.
> Problem is that if I downcast to a KoCanvasBase the dynamic cast to a
> QWidget fails.

Not sure if I understand the problem correctly, but it sounds like you
need virtual inheritance - ie., class KWCanvas : virtual public
QWidget, virtual public KoCanvasBase
Or something like that. I'm not really sure whether it would help or
not, but when I was reading some book about C++, this is what they
were using to solve various problems when one class was inheriting
from another through more other classes (multiple inheritance).

/ Tomas
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic