Thread: what is the difference between Parent & Owner ??

  1. #1
    Registered User
    Join Date
    Sep 2002

    Smile what is the difference between Parent & Owner ??


  2. #2
    Registered User
    Join Date
    Nov 2001
    Give an example of what you are asking. Are you talking about OOP?


  3. #3
    Registered User
    Join Date
    Sep 2002
    Originally posted by kuphryn
    Give an example of what you are asking. Are you talking about OOP?

    Window Frames concept,

    Like VC++ -> MFC,

    getParent() == getOwner(); // is the same thing. why????

  4. #4
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    I am familiar with this concept in VCL, and my guess is that it is the same in MFC.

    The owner is the object responsible for creating and destroying an aggregated or linked object. Normally an owner destroys the objects it owns in its destructor.

    A parent is an object which has a visual interface. Visual control objects appear in the space of their parent. For example, a button may have a parent window.

    The owner and parent objects are not necessarily the same.

  5. #5
    train spotter
    Join Date
    Aug 2001
    near a computer
    I think of this slightly differently.

    Parent is usually a control or dialog, not a window. The parent of a control or dialog is the one who gets its windows msg's. If the parent is Destroyed so will the child. The child can not exist without the parent. The child is usually asociated with a single parent.
    ie any control created at run time (without the resource editor)

    Owner is usually a dialog or window not a control. The owned item can exist independently of its owner but will also be closed if the owner does. Many different items may 'own' the item.

    ie a dialog to show a tasks progress.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. inter process communcation, parent - child
    By tallan in forum C Programming
    Replies: 5
    Last Post: 02-28-2009, 04:04 AM
  2. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  3. Problems defining classes
    By esmeco in forum C++ Programming
    Replies: 47
    Last Post: 10-24-2007, 01:13 PM
  4. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  5. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM