salmanmanekia
11th June 2008, 15:44
Hi,
May be the question ahead also comes in domain of Object Oriented ,i am confused with
class exclass :public QObject, public QGraphicsItem
{
Q_OBJECT
public:
exclass(QGraphicsItem *parent = 0);
};
#include "exclass.h"
exclass::exclass(QGraphicsItem *parent): QGraphicsItem(parent)
{
}
#include "exclass.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
exclass *mainScene = new exclass;
return a.exec();
}
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..
May be the question ahead also comes in domain of Object Oriented ,i am confused with
class exclass :public QObject, public QGraphicsItem
{
Q_OBJECT
public:
exclass(QGraphicsItem *parent = 0);
};
#include "exclass.h"
exclass::exclass(QGraphicsItem *parent): QGraphicsItem(parent)
{
}
#include "exclass.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
exclass *mainScene = new exclass;
return a.exec();
}
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..