Skip to content

Instantly share code, notes, and snippets.

@yetanotherchris
Created February 9, 2013 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yetanotherchris/4747030 to your computer and use it in GitHub Desktop.
Save yetanotherchris/4747030 to your computer and use it in GitHub Desktop.
C# to Objective C by example #2
// Checking types
-int main(int argc, const char *argv[] )
{
// There's a lot more examples in the 3rd link at the bottom
MyObject *myobj = [[MyObject alloc] init];
MyObject *myobj2 = [[MyObject alloc] init];
if ([myobj class] == [myobj2 class])
NSLog("The same types");
// Also available are isMemberofClass and various respondsTo options.
if ([myobj isKindOfClass: [MyObject class])
NSLog("myobj is a MyObject");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment