• 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: abstract class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: abstract class


  • Subject: RE: abstract class
  • From: Jeff Laing <email@hidden>
  • Date: Fri, 25 May 2007 16:15:54 +1000

> @implementation AbstractClass
> + (id) newThing:(NSString*)type
> {
> 	if ([type isEqualToString:@"A"]) {
> 		return [[[ClassForTypeA alloc] init] autorelease];
> 	} else if ([type isEqualToString:@"B") {
> 		return [[[ClassForTypeB alloc] init] autorelease];
> 	} ...etc...
> }
> @end

Having participated in this thread elsewhere, I feel obligated to point out
that according to the memory management rules
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/M
emoryManagementRules.html methods beginning with 'new' should not
autorelease the object they are returning...
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Binding to CIFilter Question
  • Next by Date: NSImage question
  • Previous by thread: Re: abstract class
  • Next by thread: Thread Pools in Cocoa / ObjC?
  • Index(es):
    • Date
    • Thread