Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt classes parent child relationship.
musimbate last edited by
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);
//When the parent dies he dies with all his children .
NOTE:This is not inheritance it is simple parent /child relationship .
Thanks for your input.
dbzhang800 last edited by
Yes, this will work as you expected.