I am writing some Qt class that is derived from QObject , it looks like this:
class A : public QObject { Q_OBJECT public: A() : QObject() {} ..... }
but in several places I saw that all the derived QObject classes have a parent element, for example:
class A : public QObject { Q_OBJECT public: A(QObject* parent = 0) : QObject(parent) {} ..... }
So the question is: do I need a parent or not? What is the difference if I have, if I have a default value (0), or I don't have one?
source share