• 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: Problem overriding a factory class mehtod
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem overriding a factory class mehtod


  • Subject: Re: Problem overriding a factory class mehtod
  • From: Ivan Kourtev <email@hidden>
  • Date: Thu, 2 Nov 2006 21:59:57 -0500

On Nov 2, 2006, at 7:14 PM, Shawn Erickson wrote:

Two ways come to mind...

======== FIRST WAY ========
@implementation FooA
+ (id) fooWithInt:(int)x
{
return [[[self alloc] initWithInt:x] autorelease]; // "self" will be the class that was sent the message, FooB if [FooB fooWithInit]
}

That's what I was looking for.

The key difference being

[[[self alloc] init...

instead of

[[[ClassName alloc] init...

Thanks!

-- ivan




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Problem overriding a factory class mehtod (From: Ivan Kourtev <email@hidden>)
 >Re: Problem overriding a factory class mehtod (From: "Alan Smith" <email@hidden>)
 >Re: Problem overriding a factory class mehtod (From: Shawn Erickson <email@hidden>)

  • Prev by Date: NSCell, copying, and objectValue
  • Next by Date: Re: Re: Problem overriding a factory class mehtod
  • Previous by thread: Re: Problem overriding a factory class mehtod
  • Next by thread: Re: Problem overriding a factory class mehtod
  • Index(es):
    • Date
    • Thread