• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: modifying self in init
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >modifying self in init (From: Mike Bolton <email@hidden>)
 >Re: modifying self in init (From: Ben Golding <email@hidden>)

  • Prev by Date: Re: build numbers
  • Next by Date: preference problem
  • Previous by thread: Re: modifying self in init
  • Next by thread: Re: modifying self in init
  • Index(es):
    • Date
    • Thread