Ok, it looks like I should assume (at least in Cocoa) that the inherited
factory methods normally return the calling class.  I guess I've normally
assumed that, but just never questioned it.  For example, I have often used
[NSMutableArray array] without even thinking about it, although I've more
often used the explicit "arrayWithCapacity". It does make me want to go back
and look at my own factory methods to make sure I implemented them the same
way.


On 11/3/08 11:20 AM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> --- On Mon, 11/3/08, Gordon Apple <[EMAIL PROTECTED]> wrote:
> 
>>       Is there a basic assumption that such factory methods
>> are implicitly
>> redefined for all subclasses?
> 
> It's not implicitly redefined -- just inherited. One of the advantages of
> Objective-C's dynamic nature is that [[[self class] alloc] init] works
> correctly when you inherit it. If you find a constructor that isn't properly
> inherited, I'd say you should probably file a bug report. (Unless we're
> talking about some special case where subclassing doesn't make much sense,
> obviously.)
> 
> Cheers,
> Chuck



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to