• 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
NSObject protocol behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Icon in window title
  • Next by Date: Re: Icon in window title
  • Previous by thread: Re: Zombies from security framework
  • Next by thread: Java/Cocoa-Java Delay
  • Index(es):
    • Date
    • Thread