Re: [Obj-C Compiler Bug?] Two different classes declaring a message with the same name - compiler warning
Re: [Obj-C Compiler Bug?] Two different classes declaring a message with the same name - compiler warning
- Subject: Re: [Obj-C Compiler Bug?] Two different classes declaring a message with the same name - compiler warning
- From: "Jonathan del Strother" <email@hidden>
- Date: Wed, 15 Oct 2008 11:50:55 +0100
On Wed, Oct 15, 2008 at 11:36 AM, Chris Suter <email@hidden> wrote:
> On Wed, Oct 15, 2008 at 9:03 PM, John Engelhart
> <email@hidden> wrote:
>>
>> On Oct 14, 2008, at 7:11 AM, Chris Suter wrote:
>>>
>>> You can't override the type for existing methods. For example,
>>> initWithString: always returns an id. You can define them as returning
>>> something different but the compiler will ignore it.
>>
>> Just a clarification on this particular point- it is possible to override
>> the type(s) of existing methods, both the argument and return types.
>
> You're quite right.
>
> What I meant to point out was that you can't easily override init
> methods because of the problem with alloc returning id. That was
> something I came across a while back which was why I got the details
> slightly wrong. :-)
>
Presumably you could override +(id)alloc to be +(MyClass)alloc on
classes that you knew implemented ambiguous init methods?
_______________________________________________
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