Re: Help on subclassing
Re: Help on subclassing
- Subject: Re: Help on subclassing
- From: Andrew Merenbach <email@hidden>
- Date: Thu, 1 Dec 2005 15:39:08 -0800
For the record (and from perhaps a naive standpoint), what reason
would there be for not making -subclassResponsibility: an NSObject
method if it would help to resolve such odd cases?
Best,
Andrew
On 1 Dec 2005, at 15:34, Will Mason wrote:
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:
40ucla.edu
This email sent to email@hidden
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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