Created
February 9, 2013 20:39
-
-
Save yetanotherchris/4747030 to your computer and use it in GitHub Desktop.
C# to Objective C by example #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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