Re: Objective-C Question
Re: Objective-C Question
- Subject: Re: Objective-C Question
- From: Lee Ann Rucker <email@hidden>
- Date: Mon, 11 Mar 2013 14:12:38 -0700
On Mar 11, 2013, at 1:45 PM, Dave wrote:
>>> myDict = [[super class] newDict];
>>
>> This should be [super newDict].
>
>> -- Seth
>
>
> Surely that would call the Instance Method (and there isn't one), I think the correct code is:
>
> [[self superclass] newDict];
>
> as someone else all ready said.
>
>
Inside a class method, "self" is an instance of class Class, so "super" also refers to the same Class object. And [self superclass] refers to a *different* Class object, so [[self superclass] foo] won't always do the same as [super foo].
/insert obligatory "it's all much more obvious in Smalltalk" here.
_______________________________________________
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