• 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: Quincey Morris <email@hidden>
  • Date: Sat, 10 Apr 2010 16:44:29 -0700

On Apr 10, 2010, at 16:02, 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?

I think the confusion here (between the question and the answers) is that the Bar object only contains a *pointer* to the Foo object, not the Foo object itself. In that sense, the Foo is *not* contained within the BAR at all -- the concept of "containing instance" doesn't exist in Obj-C (unlike, say, C++).

So, if you want your Bar to be the "parent" of a Foo, and you want the Foo to know its parent, you have to pass the Bar's object pointer as a parameter when setting up the Foo, as others have told you.


_______________________________________________

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

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