8.2.2.1. Exercises: QObject's Child Managment

  1. In Example 8.4, what local stack objects were destroyed when growBunch() returned?

  2. Notice that Alice does not appear in the dumpObjectTree() output. When does Alice get destroyed?

  3. Write your own function,

    void showTree(QObject* theparent)

    to main.cpp. The output of this function, after all objects have been created, should look like this:

    Member: Mike - Parent: A Stack Object
    Member: Greg - Parent: Mike
    Member: Peter - Parent: Mike
    Member: Bobby - Parent: Mike
    Member: Carol - Parent: A Stack Object
    Member: Marcia - Parent: Carol
    Member: Jan - Parent: Carol
    Member: Cindy - Parent: Carol
    

  4. Modify your showTree() function so that it produces the same output as dumpObjectTree().

[ fromfile: children.xml id: None ]