Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
- Subject: Re: Multiple Inheritence (Was: Is _objc_flush_caches_(Class) necessary to swizzle methods?)
- From: Tor Manders <email@hidden>
- Date: Sat, 25 Sep 2004 07:52:10 -0400
George,
perhaps the pattern you are looking for is a separate class with the
methods you want defined there (perhaps as class methods). these
methods can be invoked as
[SharedProcessingClass doSomeSharedMethodOn: self];
of course, all of the various 'self's will need to conform to some
(ideally formal) protocol so that you can polymorphically interact
with them.
then, in each of your classes, you can write a wrapper around the call
like so...
- (ReturnType) doSomething : (AType) parameter {
...
[SharedProcessingClass doSomeSharedMethodOn: self];
...
return something;
}
Tor Manders
On Fri, 24 Sep 2004 22:52:26 -0400, DumberThanDanQuayle
<email@hidden> wrote:
[cut]
>
> what I am trying to
> accomplish here, which is merely writing a method or protocol
> implementations only once, instead of multiple times (once for each
> class with a different super-class). Given that these classes needing
> a common method implementation have different super-class, they often
> have different ivar structures as well.
>
> I do not care about classes "looking" like other classes here, that is
> easily accomplished with protocols (or other techniques like
> "+poseAsClass" or message forwarding as you mentioned). I am merely
> looking for a way to write implementations once and then use them in
> ostensibly unrelated classes. This is barely multiple inheritance.
>
[cut]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden