[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Forwarding when subclassing is not possible...
From: |
Scott Christley |
Subject: |
Re: Forwarding when subclassing is not possible... |
Date: |
Fri, 15 Aug 1997 08:54:48 -0700 |
At 10:06 PM 8/14/97 -0700, Benedikt Stefansson wrote:
>
>- (void)forwardInvocation:(NSInvocation *)anInvocation {
> if ([someOtherObject respondsToSelector:
> [anInvocation selector]])
> [anInvocation invokeWithTarget:someOtherObject];
> else
> [self doesNotRecognizeSelector:[anInvocation selector]];
>}
Actually forwardInvocation (and NSInvocation) are newer methods that are
part of OpenStep, the older method is just called forward::
This is Object.m implementation of forward in the GNU runtime.
- (retval_t)forward:(SEL)aSel :(arglist_t)argFrame
{
return (retval_t)[self doesNotRecognize: aSel];
}
So you want to implement forward:: for your class and then you will get the
messages like you want.
Scott
PS: the forward:: method will always exist, for OpenStep what happens is
that NSObject's forward:: method creates an NSInvocation object then calls
the forwardInvocation: method.
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================