On Apr 10, 2010, at 7:02 PM, Tony Romano wrote:

> Thanks for the reply but I am not sure I follow your point.  An instance of 
> 'f' is contained precisely in one instance of Bar.  I can have many Bars but 
> each have their own instance of the class Foo.  Does the language support 
> getting the containing instance?


But how does the language know that only one instance of f is contained in one 
instance of Bar? You could have multiple Bars pointing to the same f, or you 
could instantiate an f without first enclosing it in a Bar. These are just dumb 
objects which you could do any number of things with.

If you need to enforce a specific one to one relationship between Bars and Fs 
you need to write code to support that. If you want Fs to know which Bar "owns" 
it, you need to write code to support that. I would suggest giving F a property 
"myBar" and giving it an initializer - (id)initWithBar:(Bar *)owner which sets 
the myBar property.

-Noah_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to