RE: abstract class
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