Re: [Foo new] vs [[Foo alloc] init]:
Re: [Foo new] vs [[Foo alloc] init]:
- Subject: Re: [Foo new] vs [[Foo alloc] init]:
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 15 Feb 2008 15:11:42 -0800
On Feb 15, 2008, at 1:55 PM, Gregory Weston wrote:
Keith Duncan wrote:
As far as I understand, [Foo new] is exactly equivalent to [[Foo
alloc] init]
Correct.
Incorrect. Based on the documentation new (by default) does setup
work analogous to alloc and then invokes init before returning the
object. It does not actually use the alloc method, though, which
means it's entirely possible for new to not be equivalent to an
alloc/init pair.
Possible? Sure. But one would be mighty optimistic to make such a
subtle distinction.
On Leopard, +new is implemented as return [[self alloc] init]; It is
equivalent unless a subclass overrides, which is exceedingly unlikely.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden