Protocol implementation split between base and derived class
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