• 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: Help on subclassing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help on subclassing


  • Subject: Re: Help on subclassing
  • From: Will Mason <email@hidden>
  • Date: Thu, 1 Dec 2005 15:34:11 -0800 (PST)

Yeah, you're right. Sorry about the bum steer. Sometimes I can't keep things straight trying to remember all the differences between various Objective-C runtimes and Cocoa and GNUstep. Thanks for clearing that up.

Just for the record, subclassResponsibility: does exist on Mac OS X, but only if your object inherits from Object (see /usr/include/objc/Object.h), which is something that no Cocoa object does.

I think for the OP his "pure virtual" method should look like this:

- (void) someMethod
{
[self doesNotRecognizeSelector: _cmd];
}

Cheers,
Will

----- Original Message ----
From: Prachi Gauriar <email@hidden>
To: Will Mason <email@hidden>
Cc: email@hidden
Sent: Thu Dec 1 17:13:06 2005
Subject: Re: Help on subclassing


On Dec 1, 2005, at 2:16 PM, Will Mason wrote:

> What one typically does in this situation, since Objective-C does
> not support "pure virtual" methods, is to declare someMethod in
> class A and define it like this:
>
> - (void) someMethod
> {
> [self subclassResponsibility: _cmd];
> }

-subclassResponsibility: doesn't exist in Mac OS X (it's in Smalltalk
though). I think it might have been in NeXTStep, but I'm not sure. -
doesNotRecognizeSelector: is the closest thing to it at this point.

-Prachi



_______________________________________________
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

  • Follow-Ups:
    • Re: Help on subclassing
      • From: Andrew Merenbach <email@hidden>
References: 
 >Re: Help on subclassing (From: Prachi Gauriar <email@hidden>)

  • Prev by Date: can I bind images to NSButtonCells in a NSMatrix?
  • Next by Date: SCPreferencesCreate
  • Previous by thread: Re: Help on subclassing
  • Next by thread: Re: Help on subclassing
  • Index(es):
    • Date
    • Thread