8.9.  Review Questions

[ fromfile: qobject-questions.xml id: qobject-questions ]

  1. What does it mean when QObject A is the parent of QObject B?

      B is managed by A, and B will be destroyed when A is.

  2. Which QObjects do not need a parent?

      Those that are allocated on the stack.

  3. What happens to a QObject when it is reparented?

      It is removed from its former parent's child list, and added to the new parent's child list.

  4. Why is the copy constructor of QObject not public?

      To prevent it from being copied. QObjects are supposed to have identity, and so there should be no "exact" copy.

  5. What is the composite pattern?

  6. How can QObject be both composite and component?

      When it has both parents and children.

  7. How can you access the children of a QObject?

  8. What is an event loop? How is it initiated?

  9. What is a signal? How do you call one?

  10. What is a slot? How do you call one?

  11. How are signals and slots connected?

  12. In the case where multiple signals are connected to the same slot, how can you determine the QObject that emitted the signal?

  13. How can information be transmitted from one object to another?

  14. Deriving a class from QObject more than once can cause problems. How might that happen accidentally?

  15. What is the difference between value types and object types? Give examples.