• 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: Why the need for the id type?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why the need for the id type?


  • Subject: Re: Why the need for the id type?
  • From: j o a r <email@hidden>
  • Date: Tue, 19 Jun 2007 21:34:25 +0200


On 19 jun 2007, at 20.40, Bill Bumgarner wrote:

* it is a means of indicating that you do, in fact, not care one little bit what type of an object the id refers to.


And in addition, you can do neat things like this:

	- (void) foo:(id <Bar>) bar;

Where you in a nice and clean OOP way indicate that you care only about the set of methods that "bar" responds to, and nothing for what class hierarchy it belongs to. Though, I guess we could just as well have solved that by allowing something like this instead:

	- (void) foo:(<Bar>) bar;


Also note that most of the times when we use (id), we actually mean (id <NSObject>). The reason that it works is of course that we effectively have a single root class in Cocoa.



j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Re: Why the need for the id type? (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: @synchronized([someObject class])
  • Next by Date: Re: Why the need for the id type?
  • Previous by thread: Re: Why the need for the id type?
  • Next by thread: Re: Why the need for the id type?
  • Index(es):
    • Date
    • Thread