What is "A class which must be subclassed" ?
What is "A class which must be subclassed" ?
- Subject: What is "A class which must be subclassed" ?
- From: Jerry Krinock <email@hidden>
- Date: Sat, 18 Oct 2008 07:43:50 -0700
I have written a class which is missing important behaviors that must
be provided by subclasses. I create one like this:
+ (id)fooWithBar:(Bar*)bar_ {
// A Bar instance knows which subclass of Foo is appropriate for
it.
// To find out, send it a -fooClass message.
id instance = [[[bar_ fooClass] alloc] init] ;
return [instance autorelease] ;
}
I'm trying to figure out what to call this. I read in "Cocoa Design
Patterns" [1] about Abstract Classes, but my Foo doesn't seem to be
quite an Abstract Class, since you could create one if you wanted to.
Is there a design pattern that I should be following for this thing?
Or maybe could/should I change it to ^be^ an Abstract Class? Or maybe
I should just leave it as is? Whatever it is, it works fine for me.
Thanks,
Jerry
[1] http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_1.html#/
/apple_ref/doc/uid/TP40002974-CH6-SW6
_______________________________________________
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