Как можно определить класс B внутри класса A так, чтобы он наследовался от класса C в C++?C++

Программы на C++. Форум разработчиков
Гость
Как можно определить класс B внутри класса A так, чтобы он наследовался от класса C в C++?

Сообщение Гость »


In class A, I define a class B. I want to hide the implementation of class B. The class B inheirts from QObject. The code like follows:

// a.h class A : public QObject { Q_OBJECT public: explict A(QObjcet* parent=nullptr); private: class B; }; //a.cpp class A::B : public QObject { Q_OBJECT public: ... } A::A(QObject* parent) : QObject(parent) { } But it has errors:

undefined reference to 'vtable for A::B' undefined reference to 'a::b::staticMetaObject' How can I fix it and why? Thanks!

Вернуться в «C++»