• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Obj-C question: protocol usage and inheritance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Obj-C question: protocol usage and inheritance
      • From: Nat! <email@hidden>
  • Prev by Date: Oops.
  • Next by Date: Re: Obj-C question: protocol usage and inheritance
  • Previous by thread: Oops.
  • Next by thread: Re: Obj-C question: protocol usage and inheritance
  • Index(es):
    • Date
    • Thread