Hi,
May be the question ahead also comes in domain of Object Oriented ,i am confused with

Qt Code:
  1. class exclass :public QObject, public QGraphicsItem
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. exclass(QGraphicsItem *parent = 0);
  7. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "exclass.h"
  2.  
  3. exclass::exclass(QGraphicsItem *parent): QGraphicsItem(parent)
  4. {
  5.  
  6. }
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. #include "exclass.h"
  2.  
  3. #include <QApplication>
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication a(argc, argv);
  8. exclass *mainScene = new exclass;
  9. return a.exec();
  10. }
To copy to clipboard, switch view to plain text mode 

I am confused with the statement

'exclass(QGraphicsItem *parent = 0); ' in the .h file and

'exclass::exclass(QGraphicsItem *parent): QGraphicsItem(parent){}' in the .cpp file

can anyone explain why the declaration as 'QGraphicsItem *parent' is necessary in the exclass constructor and why do we say it as 'QGraphicsItem *parent = 0 'in the .h file..
i avoided this question so far and just followed it but now i have to develop a QGraphicsItem parent and a child so i am confused with how to do it..