Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mdeh

macrumors 6502
Original poster
Jan 3, 2009
345
2
On p 180 of 2.0, the dealloc method is defined thus.

Code:
-(id) dealloc
{
	if (origin)
		[origin release];
	return [super dealloc];
}

Should it not be this?

Code:
-(void) dealloc
{
	if (origin)
		[origin release];
	[super dealloc];
}


I think there might also be a misquote on the same page.

"The dealloc method is defined to return a value of type id. You know this by looking inside the header file <NSObject.h>.....

NSObject.h shows this though....
- (void)dealloc;

Thanks in advance.
 

skochan

macrumors regular
Apr 1, 2006
150
0
California
I think there might also be a misquote on the same page.

"The dealloc method is defined to return a value of type id. You know this by looking inside the header file <NSObject.h>.....

NSObject.h shows this though....
- (void)dealloc;
Thanks for the catch! Later in the book dealloc is correctly referenced as a void method.

[The first edition used Object as the root object at this point in the text (and Object.h as the root header file). In that case, the free method, which does return an id object, was the method that was overridden. This didn't do well in the translation to NSObject!]



Cheers,

Steve Kochan
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.