Re: Multiple inheritance and objective-c
Re: Multiple inheritance and objective-c
- Subject: Re: Multiple inheritance and objective-c
- From: Mark Dawson <email@hidden>
- Date: Mon, 21 Mar 2005 15:32:09 -0800
That would improve the issue, but that would still mean that I'd have to implement all of the method, even if that just meant passing them through, right? I have 20-30 methods that are in common.
So class C would have
@
@interface class C {
NSMutableArray * mArray;
}
-getXXX1; ... -getXXX10;
-setXXX1(int) x; ... -setXXX10(int) x;
@end
Class B would look something like (assuming I could inline like C++):
@interface class B : class A {
C *mSharedClass;
};
-getXXx1() { return [mSharedClass getXXX1]; }
..
-getXXx01() { return [mSharedClass getXXX10]; }
@end
On Mar 21, 2005, at 3:15 PM, John C. Warner wrote:
On 21 Mar, 2005, at 6:11 PM, Mark Dawson wrote:
I have class B that inherits from class A. I now need to make a class C. It turns out that 90% of the functionality (including class variables) would be shared between B's implementation (its subclass implementation) and C's implementation. In C++, I would break out that functionality, creating class D. Class B would inherit from A AND D, while C would inherit from D. I know that objective-c doesn't have multiple inheritance, so I was wondering how similar class functionality is handled there. Note that I DO have class variables (instance variables), which precludes using categories to support this.
Can you just make Class C keep an instance of Class B as an instance variable?
-John
_______________________________________________
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
_______________________________________________
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