Answer the question
In order to leave comments, you need to log in
How can I properly inherit a class?
There is a class:
class one : public QObject
{
Q_OBJECT
int per;
public:
one(int per) { this->per = per; }
};
class two : public one {};
Answer the question
In order to leave comments, you need to log in
constructors are not inherited.
class one
{
public:
Q_OBJECT
one(int a)
{
}
};
class two : one
{
public:
Q_OBJECT
two(int a)
:one(a)
{
}
};
int main()
{
one * s = new two(1);
return 0;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question