| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
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.
| References: | |
| >Re: Subclass (From: Sailor Quasar <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.