On Fri, Oct 10, 2008 at 12:52 PM, Negm-Awad Amin <[EMAIL PROTECTED]> wrote:
> Yup, you are complelty right. The correct code:
>
> if( [BaseClass [EMAIL PROTECTED]( initIWithCoder: )] ) {
> …

If you want to get really fun, you can check it thus:

if([super.class instancesRespondToSelector:...])

This works because the 'super' keyword just gives you a struct of type
objc_super, and you can access its members directly. (Note that in
ObjC++ you will have to use super.super_class instead.) The advantage
here is that you aren't hardcoding the name, so if you change what
class you derive from the code will continue to work as intended.

And before anyone jumps in, [self superclass] will *not* work, because
it fails if 'self' is an instance of a subclass of your class.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to