Hi,
What should be the count of children()?? I think it should be 3. But it shows 0. Can anyone correct me...
public:
mainObject
( QObject * parent
= 0 ){} ~mainObject(){}
};
class myObject : public mainObject{
public:
myObject
( QObject * parent
= 0 ) : mainObject
( parent
){} ~myObject(){}
};
int main(int argc, char *argv[]){
mainObject* ob = new mainObject;
myObject* a = new myObject(ob);
myObject* b = new myObject(ob);
myObject* c = new myObject(ob);
qDebug() << ob->children().count();
return 0;
}
class mainObject : public QObject{
public:
mainObject( QObject * parent = 0 ){}
~mainObject(){}
};
class myObject : public mainObject{
public:
myObject( QObject * parent = 0 ) : mainObject( parent ){}
~myObject(){}
};
int main(int argc, char *argv[]){
mainObject* ob = new mainObject;
myObject* a = new myObject(ob);
myObject* b = new myObject(ob);
myObject* c = new myObject(ob);
qDebug() << ob->children().count();
return 0;
}
To copy to clipboard, switch view to plain text mode
Thanks
Bookmarks