QObjects on interfaces

Kris Wong wongk at seapine.com
Fri Jul 25 11:47:38 UTC 2008


> class IFoo : public QObject {};
> class IBar : public QObject {};
> class FooBar : public IFoo, public IBar {}; // this is now impossible.

That is not true.  C++ isn't java. ;)

http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.8

class IFoo : public virtual QObject {};
class IBar : public virtual QObject {};
class FooBar : public IFoo, public IBar {};  // works like a charm

Kris Wong




More information about the KDevelop-devel mailing list