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: Sun, 17 Feb 2008 12:06:22 -0800
On Feb 17, 2008, at 11:15 AM, Gregory Weston wrote:
See what you're saying? +alloc *or* +allocWithZone:.
See the subject? +alloc. It does not say anything about
+allocWithZone:.
See this code?
@interface MyTest : NSObject
@end
@implementation MyTest
+ (id)alloc
{
NSLog(@"allocating");
return [super alloc];
}
@end
You would have to override +allocWithZone: to have any kind of
reliable behavior. +alloc is a cover for +allocWithZone: with a NULL
zone. Not that you would know that from the documentation,
unfortunately.
Without assuming anything, you would have to override both allocator
methods; +alloc and +allocWithZone:.
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