NSObject protocol behavior
NSObject protocol behavior
- Subject: NSObject protocol behavior
- From: Miguel Morales <email@hidden>
- Date: Thu, 24 May 2001 16:57:43 -0700
Dear all,
I'm getting behavior where the complier does not seem to be traversing
the inheritance tree for methods if more than one extra protocol is
defined in a @protocol statement. I have the following code:
#include <Foundation/Foundation.h>
@protocol testprotocol <NSObject, NSCopying>
-(void)extramethod;
@end
@interface mytest : NSObject <testprotocol>
{}
@end
@implementation mytest
-(void)extramethod{
printf("Help\n");
return;
}
-(id)copyWithZone:(NSZone *)zone{}
@end
and it complains bitterly about missing NSObject methods, even though it
inherits from NSObject. However the following code:
#include <Foundation/Foundation.h>
@protocol testprotocol <NSObject>
-(void)extramethod;
@end
@interface mytest : NSObject <testprotocol, NSCopying>
{}
@end
@implementation mytest
-(void)extramethod{
printf("Help\n");
return;
}
-(id)copyWithZone:(NSZone *)zone{}
@end
where I've moved the NSCopying protocol from the @protocol to the
@interface works fine. What is going on? Is there something I don't
understand or is this a compilier issue?
Thanks for your help,
-Miguel