objective c - Also found '-(void) init' -
i built custom class named game:
.h
-(void) init;
here have found '-(void) init'
.m
-(void) init { [super init]; score = 0; lives = 3; elements = [[nsmutablearray alloc] initwithcapacity:1000]; }
when try initialize object with:
mygame = [[game alloc] init];
i got "multiple methods named '-init' found don't know error is...
init should return (id). change function following:
.h
-(id) init;
.m
-(id) init { if((self = [super init])) { score = 0; lives = 3; elements = [[nsmutablearray alloc] initwithcapacity:1000]; } return self; }
Comments
Post a Comment