• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Lack of Initializers or Factory Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lack of Initializers or Factory Methods


  • Subject: Re: Lack of Initializers or Factory Methods
  • From: Gordon Apple <email@hidden>
  • Date: Mon, 03 Nov 2008 12:03:08 -0600
  • Thread-topic: Lack of Initializers or Factory Methods

    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@hidden"
<email@hidden> wrote:

> --- On Mon, 11/3/08, Gordon Apple <email@hidden> 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 (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

  • Prev by Date: NSNumberFormatter: Display INT as decimal
  • Next by Date: Re: NSTableView problems
  • Previous by thread: Re: Lack of Initializers or Factory Methods
  • Next by thread: asl_search() no longer returns old messages
  • Index(es):
    • Date
    • Thread