Skip to content

Instantly share code, notes, and snippets.

@mmower
Created September 14, 2008 23:29
Show Gist options
  • Select an option

  • Save mmower/10778 to your computer and use it in GitHub Desktop.

Select an option

Save mmower/10778 to your computer and use it in GitHub Desktop.
@implementation A
- (id)initWithX:(id)x {
if( self = [self init] ) {
// do with x
}
return self;
}
@end
@implementation B
- (id)initWithX:(id)x {
return [super initWithX:x];
}
- (id)init {
return [super initWithX:defaultX];
}
@end
[[B alloc] init] -> stack overflow
B init calls A initWithX which calls init, which ends up in B init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment