Results 1 to 3 of 3

Thread: Terminology with object relationships

  1. #1
    Join Date
    Nov 2005
    Location
    Scandinavia
    Beans
    939

    Terminology with object relationships

    Although i understand the relationship between parent and child classes, i'm not quite sure about the relationship (the terminology that is) between an object created within another object.
    To clarify with a bit of pseudo-code:
    Code:
    class ObjectA {
        // stuff
    }
    
    class ObjectB() {
        newobject = new ObjectA()
    }
    It sure feels like the terminology would be apt here as well (even though it's not the same thing).
    In UML diagrams newobject would be an an aggregate or composition.

    In this discussion they do mention child object; http://programmers.stackexchange.com...psulation-in-c
    Would it then be correct to assume you could call ObjectB a parent object to newobject?
    I'm not even sure if it's even meaningful to have names for the relationships between them.
    - "though It seems that I know that I know, what I would like to see Is the I that sees me, when I know that I know that I know" / Alan Watts

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,172
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Terminology with object relationships

    newObject is just an atttribute of ObjectA. Ther is no special class relationship. newobject can be anything, a base type (int/float), some aggregate (array/struct). And an object of the same type as newObject could also be an attribute in completely unrelated classes.
    Warning: unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.

  3. #3
    Join Date
    Nov 2005
    Location
    Scandinavia
    Beans
    939

    Re: Terminology with object relationships

    I saw another guy ask pretty much the same question here; http://stackoverflow.com/questions/9...owner-instance, but he referred to an objects "owner" (what i speculated could be a parent object). Perhaps a more apt description, even though as you so kindly pointed out there really isn't a word for it.
    I guess i thought there was a special relationship between objects like that from doing GUI programming, specifically Qt, where most objects (widgets) you create have a "parent", and optionally more own "children" (widgets). I suppose it makes sense in that regard.
    Anyway, thanks for clearing that up.
    - "though It seems that I know that I know, what I would like to see Is the I that sees me, when I know that I know that I know" / Alan Watts

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •