Re: modifying self in init
Re: modifying self in init
- Subject: Re: modifying self in init
- From: Ben Golding <email@hidden>
- Date: Thu, 16 Sep 2004 17:16:19 +1000
Darn it, I spotted a silly mistake in my code. No doubt you all
spotted it anyway ...
On 16/09/2004, at 16:41, Ben Golding wrote:
@implementation FileReader
- (id)initWithPath:(NSString *)path
{
if ((self = [super init]) == nil)
return nil;
[self setFilename:path];
[self setIvar1:blah];
[self setIvar2:bleh];
return self;
}
@implementation A : FileReader // bastardised Objective C but
anyway ...
- (id)initWithPath:(NSString *)path
{
if ((self = [super init]) == nil)
This line should read:
if ((self = [super initWithPath:path]) == nil)
return nil;
// special stuff for A
return self;
}
@end
@implementation B : FileReader
{
if ((self = [super init]) == nil)
Same here:
if ((self = [super initWithPath:path]) == nil)
return nil;
// special stuff for B
return self;
}
@end
Sorry about that.
Ben.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden