• 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: "Lawrence Sanbourne" <email@hidden>
  • Date: Sun, 7 May 2006 11:56:07 -0500

On 5/7/06, Ben Dougall <email@hidden> wrote:
Todd, thanks for the reply.

On Sunday, May 7, 2006, at 05:03  pm, Todd Blanchard wrote:

> isKindOfClass: I think tests to see if you are a subclass of a given
> class.  Its what I have used before.

i'm not after subclasses though -- just is of a particular type or not.
so [anObject class] == [AClass self] works fine but is there any reason
i should use isMemberOfClass instead of that? (isMemberOfClass is the
one that's appropriate for me out of isMemberOfClass and isKindOfClass).

-isKindOfClass: actually returns YES if the object is a member of the given class or is a subclass of the given class. This is probably the behavior you want, because say you're testing an object that's passed into the method: If the user of the method passes an NSMutableString but your class only checks for isMemberOfClass:[NSString class], then your method won't work. So I would go with -isKindOfClass:.

Larry
_______________________________________________
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


  • Follow-Ups:
    • Re: object type testing
      • From: Andy Lee <email@hidden>
References: 
 >Re: object type testing (From: Todd Blanchard <email@hidden>)
 >Re: object type testing (From: Ben Dougall <email@hidden>)

  • Prev by Date: Re: Which format for image file resources in Cocoa application?
  • Next by Date: Re: frameworks
  • Previous by thread: Re: object type testing
  • Next by thread: Re: object type testing
  • Index(es):
    • Date
    • Thread