Re: object type testing
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