Skip to content

Instantly share code, notes, and snippets.

@hashier
Created June 4, 2014 18:43
Show Gist options
  • Save hashier/01bdd7d2a22e58c0f8fc to your computer and use it in GitHub Desktop.
Save hashier/01bdd7d2a22e58c0f8fc to your computer and use it in GitHub Desktop.
Clang and return types
2014-06-04 20:43:10.363 Untitled 9[49902:507] Output: http://www.apple.com
2014-06-04 20:43:10.365 Untitled 9[49902:507] Output: NSString
#import <Foundation/Foundation.h>
@interface ExampleClass : NSObject
- (NSString *)meh;
- (NSURL *)muh;
@end
@implementation ExampleClass
- (NSString *)meh {
return [NSURL URLWithString:@"http://www.apple.com"];
}
- (NSString *)muh {
return @"NSString";
}
@end
int main(int argc, char *argv[]) {
@autoreleasepool {
ExampleClass *tmp = [[ExampleClass alloc] init];
NSLog(@"Output: %@", [tmp meh]);
NSLog(@"Output: %@", [tmp muh]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment