Created
September 8, 2014 03:08
-
-
Save HeidiHansen/ac09bf3a3ec1a0588dcc to your computer and use it in GitHub Desktop.
Designated Initializers
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
- (instancetype)init | |
{ | |
return [self initWithName:@""]; | |
} | |
- (instancetype)initWithName:(NSString *)name | |
{ | |
return [self initWithName:name | |
Gender:YES | |
AgeIs:@9 | |
HeightIs:@9 | |
withFriends:[[NSMutableArray alloc]init]]; | |
} | |
- (instancetype)initWithName:(NSString *)name | |
Gender:(BOOL)isFemale | |
AgeIs:(NSNumber *)age | |
HeightIs:(NSNumber *)height | |
withFriends:(NSMutableArray *)friends; | |
{ | |
self = [super init]; | |
if (self) { | |
self.name=name; | |
_isFemale=isFemale; | |
_age=age; | |
_height=height; | |
_friends= friends; | |
} | |
return self; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment