I have a class called MiscData
that inherits QObject
and has a member variable (a model). And then bunch of other classes that inherit MiscData
and reimplement its virtual function to populate the model. So it looks like this:
class MiscData : public QObject
{
Q_OBJECT
public:
explicit MiscData(QObject *parent = 0);
QAbstractItemModel &model();
private:
virtual void loadData() = 0;
private:
QStandardItemModel m_Model;
}
and one of the descendant looks like this:
class LogData : public MiscData
{
Q_OBJECT
public:
using MiscData::MiscData;
private:
virtual void loadData() override;
}
I know that I must use an explicit constructor for MiscData
because it initializes the model member variable. But I am wondering whether it is safe to use using
directive in the derived class to inherit MiscData
's constructor like this.
EDIT: Based on the answer it seems to be fine event to use using QObject::QObject
in the MiscData too.