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

object type testing


  • Subject: object type testing
  • From: Ben Dougall <email@hidden>
  • Date: Sun, 7 May 2006 16:41:55 +0100

hello,

regarding finding out if an object instance is a particular type of class or not

which should be used out of the following three?:

if( [anObject isMemberOfClass:[AClass class]] ) {
	...

if( [anObject class] == [AClass self] ) {
	...

if( [[anObject className] isEqualToString:@"AClass"] ) {
	...

i suppose the last one is only necessary if you're dealing with class names in strings, otherwise not necessary. i'm currently using [anObject class] == [AClass self] but am wondering if it's OK?

thanks, ben

_______________________________________________
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: Uli Kusterer <email@hidden>
    • Re: object type testing
      • From: "Lawrence Sanbourne" <email@hidden>
    • Re: object type testing
      • From: Todd Blanchard <email@hidden>
  • Prev by Date: Re: Conditionally setting a table column cell to be editable, based on another column's value?
  • Next by Date: Re: object type testing
  • Previous by thread: Re: frameworks
  • Next by thread: Re: object type testing
  • Index(es):
    • Date
    • Thread