Obj-C question: protocol usage and inheritance
Obj-C question: protocol usage and inheritance
- Subject: Obj-C question: protocol usage and inheritance
- From: Normand Rivard <email@hidden>
- Date: Sun, 15 Sep 2002 13:27:05 -0400
Hi,
I know this forum is not specifically dedicated to Objective-C, but I
thought it was the place where most Obj-C experts are found. Sorry if I
am at the wrong place (just tell me).
Here is my question:
I am trying to use a protocol to type my class hierarchy. For example,
here is what I have:
@interface MyClass : MySuperClass <MyClassType>
{
}
@end
@implementation UMLClass
@end
@protocol MyClassType
- (NSString *) name;
- (void) setName: (NSString *) newName;
@end
@interface MySuperClass : NSObject
{
@protected
NSString* _name;
}
- (NSString *) name;
- (void) setName: (NSString *) newName;
@end
The problem is that the compiler gives me warning because name and
setName are not implemented in MyClass (which is true: these methods are
inherited from MySuperClass). I thought the compiler would notice that
MyClass has access to these methods by inheritance.
How do you people usually deal with this? Do you re-define inherited
methods in sub-classes (yuck)? Are you even using protocol for
polymorphism?
Thanks in advance.
Normand
____________________________________________________________
"What you do instead of your real work *is* your real work."
- Roger Ebert
____________________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.