C++ (Qt)class A : public QObject {...};class B : public A, public QWidget {...};
C++ (Qt)class A : public virtual QObject {...};
C++ (Qt)#include <QtGui> struct Test1 : virtual public QObject { int mData1;}; struct Test2 : virtual public QObject { int mData2;}; struct Test3 : public Test1, public Test2 { int mData3;}; int main(int argc, char **argv){ QApplication app(argc, argv); Test3 test3; test3.mData1 = 1; test3.mData2 = 2; test3.mData3 = 3; Test1 * test1 = (Test1 *) &test3; Test2 * test2 = (Test2 *) &test3; QObject * base1 = dynamic_cast<QObject *> (test1); QObject * base2 = dynamic_cast<QObject *> (test2); QObject * base3 = dynamic_cast<QObject *> (&test3); printf("test1 = %p, base1 = %p\n" "test2 = %p, base2 = %p\n" "test3 = %p, base3 = %p\n", test1, base1, test2, base2, &test3, base3); return 0;}