Recently I started working on a QT project, but there are more syntax rules than regular C++.
While declaring class and its constructor, in header file, we simply write
class MyObj : public QObject {
Q_OBJECT
public:
explicit MyObj(QObject* parent = nullptr, <params>, ...)
.
.
<some more declarations>
private:
.
.
<some more declarations>
};
In .cpp file, we can define this constructor as
MyObj::MyObj(QObject* parent, <params>) :
QObject(parent),
...
<some more parameter like arguments, that is what I am exactly asking>
{
<regular initializations>
}
I am asking about the parameter like arguments after the : operator in the first line of declaring an initializing the class.
What are they, why QT needs these?
Note: In QT project examples, you can simply find the "Command Line Writer Async" example. In that project, a proper usage of this fact exists. I am using QT 5.15.