• 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: object type testing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object type testing


  • Subject: Re: object type testing
  • From: Sherm Pendley <email@hidden>
  • Date: Sun, 7 May 2006 15:28:39 -0400

On May 7, 2006, at 12:03 PM, Todd Blanchard wrote:

This is even a bit restricting since it may not tell you all you need to know to be compatible. For instance, it may be that the object subclasses NSObject but still implements the protocol you need - so you can call conformsToProtocol: to see if this is true. If there is a formal protocol defined, this is probably the best way to check if the object is what you expect.

If you're using a formal protocol, you can also check at compile- time, by declaring it as part of the type:


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

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >object type testing (From: Ben Dougall <email@hidden>)
 >Re: object type testing (From: Todd Blanchard <email@hidden>)

  • Prev by Date: Re: object type testing
  • Next by Date: Re: object type testing
  • Previous by thread: Re: object type testing
  • Next by thread: Re: object type testing
  • Index(es):
    • Date
    • Thread