Как можно определить класс таким образом, чтобы он наследовался от QObject, а также внутри класса, производного от QObje ⇐ C++
Как можно определить класс таким образом, чтобы он наследовался от QObject, а также внутри класса, производного от QObje
In class A, I define a class B. I want to hide the implementation of class B. The class B inherits from QObject.
// a.h class A : public QObject { Q_OBJECT public: explicit A(QObjcet* parent=nullptr); private: class B; QSharedPointer m_impl; }; //a.cpp class A::B : public QObject { Q_OBJECT public: ... }; A::A(QObject* parent) : QObject(parent), m_impl(QSharedPointer(new B())) { } But it has errors:
undefined reference to 'vtable for A::B'
undefined reference to 'A::B::staticMetaObject'
What causes them, and how can I fix them?
Источник: https://stackoverflow.com/questions/780 ... s-well-wit
In class A, I define a class B. I want to hide the implementation of class B. The class B inherits from QObject.
// a.h class A : public QObject { Q_OBJECT public: explicit A(QObjcet* parent=nullptr); private: class B; QSharedPointer m_impl; }; //a.cpp class A::B : public QObject { Q_OBJECT public: ... }; A::A(QObject* parent) : QObject(parent), m_impl(QSharedPointer(new B())) { } But it has errors:
undefined reference to 'vtable for A::B'
undefined reference to 'A::B::staticMetaObject'
What causes them, and how can I fix them?
Источник: https://stackoverflow.com/questions/780 ... s-well-wit
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение