• 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
Protocol implementation split between base and derived class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Protocol implementation split between base and derived class


  • Subject: Protocol implementation split between base and derived class
  • From: Scott Hancher <email@hidden>
  • Date: Wed, 8 Dec 2004 14:35:17 -0800

I've defined a protocol. I have several classes that need to implement this protocol. A subset of the protocol methods have general implementations that can be implemented in a common super class. However, XCode doesn't appear to accept the super class's implementation in determining whether each derived class implements the entire protocol.

I can get around this by adding an implementation of each of the super class methods in each subclass and calling the corresponding super method. This step doesn't seem like it should be necessary though.

Is there any other way around this? Is this a bug in XCode?

I've included a simple example of the problem I've described along with the corresponding XCode warnings.

++Scott.

@protocol FooProtocol
- (void)Foo1;
- (void)Foo2;
@end

@interface BaseFoo
- (void)Foo1;
@end

@interface Foo : BaseFoo <FooProtocol>
- (void)Foo2;
@end

@implementation BaseFoo

- (void)Foo1
{
	NSLog( @"Foo1 called." );
}

@end

@implementation Foo

- (void)Foo2
{
	NSLog( @"Foo2 called." );
}

@end


warning: incomplete implementation of class `Foo' warning: method definition for `-Foo1' not found warning: class `Foo' does not fully implement the `FooProtocol' protocol

_______________________________________________
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


  • Follow-Ups:
    • Re: Protocol implementation split between base and derived class
      • From: Marcel Weiher <email@hidden>
    • Re: Protocol implementation split between base and derived class
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: Obj-C as a viable multi target language
  • Next by Date: NSTask launch of suid helper tool will not terminate...
  • Previous by thread: Re: Cocoa HTML Decoder
  • Next by thread: Re: Protocol implementation split between base and derived class
  • Index(es):
    • Date
    • Thread