• 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: Design Paterns: +/- Initializers and Subclassing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Design Paterns: +/- Initializers and Subclassing


  • Subject: Re: Design Paterns: +/- Initializers and Subclassing
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 2 Aug 2009 22:26:45 -0700

On Aug 2, 2009, at 22:17, Christopher J Kemsley wrote:

How do I make the +method call return an initialized object of whatever type the +method was sent to? (so that [CYMethodSubclass method] returns [ [ [CYMethodSubclass alloc] init ] autorelease])

Like this:

	return [ [ [[self class] alloc] init ] autorelease ] ;

('self' refers to the class object because this is a class method)


_______________________________________________

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


  • Follow-Ups:
    • Re: Design Paterns: +/- Initializers and Subclassing
      • From: Quincey Morris <email@hidden>
References: 
 >Design Paterns: +/- Initializers and Subclassing (From: Christopher J Kemsley <email@hidden>)

  • Prev by Date: Design Paterns: +/- Initializers and Subclassing
  • Next by Date: Re: Design Paterns: +/- Initializers and Subclassing
  • Previous by thread: Design Paterns: +/- Initializers and Subclassing
  • Next by thread: Re: Design Paterns: +/- Initializers and Subclassing
  • Index(es):
    • Date
    • Thread