Qt classes parent child relationship.
-
Hi all,
I was designing some classes for my application and wondered if the parent /child relationship of Qt can allow me to do something like this:
@
QObject * fatherObject=new QObject(0);//I dynamically create a memory space.The parent should take care of cleaning up for this memory space even after we loose access to it by assigning pmClass pointer to another dynamically allocated space.
Qclass * pmClass= new QClass(fatherObject);pmClass=new QClass(fatherObject);
.........................................
//When the parent dies he dies with all his children .
delete fatherObject;@
NOTE:This is not inheritance it is simple parent /child relationship .
Thanks for your input.
-
Yes, this will work as you expected.