Created
January 17, 2013 15:43
-
-
Save McZonk/4556864 to your computer and use it in GitHub Desktop.
instancetype benefits
This file contains hidden or 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
@interface Octopus : NSObject | |
+ (instancetype)octopus; | |
- (instancetype)init; | |
@property (nonatomic, assign) int legs; | |
@end | |
@implementation Octopus | |
+ (instancetype)octopus { | |
return [[Octopus alloc] init]; | |
} | |
- (instancetype)init { | |
self = [super init]; | |
if(self != nil) { | |
} | |
return self; | |
} | |
+ (int)someMethod { | |
int x = [Octopus octopus].legs; | |
int y = [[Octopus alloc] init].legs; | |
return x + y; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment