Become a MacRumors Supporter for $25/year with no ads, private forums, and more!

iOS How can I describe a relationship between an object of which another object is a property?

moonman239

macrumors 68000
Original poster
Mar 27, 2009
1,530
22
In the English language, when we want to convey the idea that John is Jane's son, we might say "John is Jane's son". Or, we might say "Jane is John's mother." What we convey directly is how Jane is related to John.

Suppose object A has a property, which is Object B. How can we describe this relationship? Obviously, we can say "object B is a property of object A." Or we could say "Object A has one property, which is Object B." But how can we describe this relationship in a way that resembles the second description of Jane (that she is John's mother)? A few possibilities come to mind: we could call A B's container, or maybe its owner. What other possibilities are there?
 
Last edited:

waterskier2007

macrumors 68000
Jun 19, 2007
1,823
163
Novi, MI
I may just be totally screwing this up, but I think you can use a weak reference to avoid a retain cycle, so if A is the parent with one->many children, you would have a strong array property that contains the children. You could then have a weak property on the children that points to their 'parent'. This way, if the parent is deallocated, the child is not still hanging on to that reference.

I just got sad thinking about a parent dying or something :(
 
Comment

*SteveB*

macrumors newbie
Jan 22, 2015
19
12
I would be inclined to say that if object A had property object B, then A 'holds a reference' to B.

A 'owns' B is usually, but not always accurate (at least, according the terminology I would usually use). I usually think that if one object owns another, then it has a strong reference to that object. A can't really own B if B will still exist after A has been destroyed.
 
Comment
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.