Re: Subclass
Re: Subclass
- Subject: Re: Subclass
- From: Sailor Quasar <email@hidden>
- Date: Sat, 14 Jun 2003 04:22:52 -0400
On Friday, June 13, 2003, at 11:14 PM, Marco Scheurer wrote:
Is there another way to do this in Obj-C.
At runtime. You can implement these methods to send a
doesNotRecognizeSelector: message. Or, there used to be a
subclassResponsibility: method in NSObject, but it's not there
anymore. You could create one that raises a meaningful exception and
use it.
With all due respect to the Obj-C veterans on these lists, and aplogies
for cross-posting to cocoa-dev, the functionality requested by the
original poster of this thread is one of several minor OO bits that C++
has but Obj-C does not that I feel would be better off there:
1. As noted, enforcement of pure virtual base classes.
2. The ability to declare methods protected or private I'm aware it's
quite possible to declare private methods as a category within the
class' source file so that the selectors are not published to client
code. For private methods this is fine since it prevents unwanted code
from easily using them, but for protected methods it's a nusiance at
best and not doable at worst.
3. The ability to declare static instance vars (instance vars that are
part of the class object rather than of any instance of that class). If
I've missed this functionality somewhere, please tell me where it is. I
generally use globals to emulate it, which I personally feel is bad
style.
4. This isn't really a missing Obj-C feature, but a lack in the gcc
syntax: it is impossible to attach __attribute__((unused)) to a method
parameter (in my experience) due to the way Obj-C is parsed by the
compiler. If you are like me and like to turn on a lot of warnings,
you'll quickly find yourself needing to add -Wno-unused-parameters to
your OTHER_CFLAGS or to specific files.
-- Sailor Quasar, guardian of Leraz's memory
"Face of stone, mind of calm, soul of love."
Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.