• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ObjC question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ObjC question


  • Subject: Re: ObjC question
  • From: Noah Desch <email@hidden>
  • Date: Sat, 10 Apr 2010 19:13:28 -0400


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@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: ObjC question
      • From: Dave Carrigan <email@hidden>
References: 
 >ObjC question (From: Tony Romano <email@hidden>)
 >Re: ObjC question (From: Seth Willits <email@hidden>)
 >Re: ObjC question (From: Tony Romano <email@hidden>)

  • Prev by Date: Re: ObjC question
  • Next by Date: Re: ObjC question
  • Previous by thread: Re: ObjC question
  • Next by thread: Re: ObjC question
  • Index(es):
    • Date
    • Thread