• 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: What is "A class which must be subclassed" ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is "A class which must be subclassed" ?


  • Subject: Re: What is "A class which must be subclassed" ?
  • From: "Michael Ash" <email@hidden>
  • Date: Sat, 18 Oct 2008 21:16:05 -0400

On Sat, Oct 18, 2008 at 10:43 AM, Jerry Krinock <email@hidden> wrote:
> 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.

The question is not *can* you create one (because in ObjC you can
*always* create an instance of any class), the question is does it
make *sense* to create one. If the answer is yes, then the behavior
it's missing can't be *that* important. If the answer is no, then it's
an abstract class.

Mike
_______________________________________________

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: What is "A class which must be subclassed" ?
      • From: Jerry Krinock <email@hidden>
References: 
 >What is "A class which must be subclassed" ? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: 10.4 v. 10.5 SDK question
  • Next by Date: Application quits when clicking "Ok" button is NSBeginCriticalAlertSheet in Tiger OS
  • Previous by thread: Re: What is "A class which must be subclassed" ?
  • Next by thread: Re: What is "A class which must be subclassed" ?
  • Index(es):
    • Date
    • Thread