QObject与其的派生类之间的转换?
有这么一个类:
//a.hclass A :public QObject{ Q_OBJECT public: A(QObject *parent=0); void fun1(); void fun2(); private: int x; int y;};//a.cppA::A(QObject *parent):QObject(parent),x(1),y(2){}void A::fun1(){ A a=*this; //这么搞会出现错误:QObject::QObject(const QObject&)是私有的 a.fun2();}void A::fun2() {.....}
A(const A& a) { x = a.x; y = a.y; }