Re: compiler warning for not fully implementing protocol
Re: compiler warning for not fully implementing protocol
- Subject: Re: compiler warning for not fully implementing protocol
- From: "Adam R. Maxwell" <email@hidden>
- Date: Thu, 31 Jul 2008 20:13:30 -0700
On Jul 31, 2008, at 4:14 PM, Mark Sanvitale wrote:
I think I am doing exactly what you say is necessary (i.e. declare
the second method in the superclass's public interface).
Here are some code snippets:
Turning your code snippets into a test program, I can't reproduce that
compiler warning, or in a trivial test where the superclass declares/
implements copyWithZone: and the subclass declares conformance. If
this works for you, what did I miss?
// File test.m, compile & run with `cc test.m -framework Foundation -o
test && ./test`
#import <Foundation/Foundation.h>
@protocol PortalTabProtocol
- (void)refreshDisplay:(id)capture because:(int)trigger;
@end
@interface PortalTabView : NSObject <PortalTabProtocol>
- (NSString *)tabName;
- (void)refreshDisplay:(id)capture because:(int)trigger;
- (id)displayCapture;
@end
@protocol ReadArchiveClient
- (id)displayCapture;
- (void)processedArchive:(id)archive;
@end
@interface PortalActionView : PortalTabView <ReadArchiveClient>
@end
@implementation PortalTabView
- (NSString *)tabName; { return nil; }
- (void)refreshDisplay:(id)capture because:(int)trigger; {}
- (id)displayCapture; { return nil; }
@end
@implementation PortalActionView
- (void)processedArchive:(id)archive {}
@end
int main (int argc, char const *argv[])
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
id obj = [[PortalActionView alloc] init];
if ([obj conformsToProtocol:@protocol(ReadArchiveClient)])
NSLog(@"PortalActionView conforms");
else
NSLog(@"PortalActionView does not conform");
[pool release];
return 0;
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden