Using performSelector: on super
Using performSelector: on super
Hello list
My superclass (SuperSocket) provides a private method -close.
My subclass overrides this private method as follows:
- (void)close
{
SEL closeSelector = @selector(close);
if ([SuperSocket instancesRespondToSelector:closeSelector]) {
[super performSelector:closeSelector]; // seems to send to self
} else {
NSAssert (NO, @"SuperSocket no longer responds to close message.");
}
// subclass additional code
}
If I am not mistaken this code appears to send the close selector to
the self object.
If [super performSelector:closeSelector] is replaced by [super close]
then the super object receives the close message as expected.
I know that [super respondsToSelector: closeSelector] is equivalent to
[self respondsToSelector: closeSelector] as the methods tests the
object as a whole (see NSObject Protocol Reference entry for
respondsToSelector;);
So is that the story here?
Or am I on the wrong page entirely.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden