c++ QObject's Child Management
This question is from a past exam paper and it is used for revision purposes 

`#include <QApplication>`

`#include <QLabel>`

`#include <QVBoxLayout>` 

`#include <QTextEdit>`

`#include <QWidget>` 

`int main (int argc, char* argv[]) {` 

 `QApplication app (argc, argv);`

`QWidget window;` 

`QLabel* label =  new QLabel("Please enter some text");`

`QTextEdit* textEdit = new QTextEdit;`

`QVBoxLayout* layout = new QVBoxLayout;`

`layout->addwidget(label);`

`layout->addwidget(textEdit);`

`window.setLayout(layout);`

`window.show;`

`return app.exec();`

`)`

1.1  Qt provides a child management facility through the QObject class. w the QObject in the program above? Explain

1.2 The QObject class provides the function setParent(QObject *parent) to specify a Qbject to be its parent. Why is this function not use in this program?

1.3 The program uses both heap and stack objects. Explain how the parnt-child facility works when the:
(a) parent is a heap obhect and the child objects are stack objects
(b)parent is a stack obhect and the child objects are heap objects



c++ QObject's Child Management
===

This question is from a past exam paper and it is used for revision purposes 

`#include <QApplication>`

`#include <QLabel>`

`#include <QVBoxLayout>` 

`#include <QTextEdit>`

`#include <QWidget>` 

`int main (int argc, char* argv[]) {` 

 `QApplication app (argc, argv);`

`QWidget window;` 

`QLabel* label =  new QLabel("Please enter some text");`

`QTextEdit* textEdit = new QTextEdit;`

`QVBoxLayout* layout = new QVBoxLayout;`

`layout->addwidget(label);`

`layout->addwidget(textEdit);`

`window.setLayout(layout);`

`window.show;`

`return app.exec();`

`)`

1.1  Qt provides a child management facility through the QObject class. w the QObject in the program above? Explain

1.2 The QObject class provides the function setParent(QObject *parent) to specify a Qbject to be its parent. Why is this function not use in this program?

1.3 The program uses both heap and stack objects. Explain how the parnt-child facility works when the:
(a) parent is a heap obhect and the child objects are stack objects
(b)parent is a stack obhect and the child objects are heap objects


