#import <Foundation/Foundation.h>
@interface dog:NSObject<logging>{
@private
int age;
}
@property int age;
@end
@implementation dog
@synthesize age;
-(void)log{
NSLog(@" this is a god having age %d ",age);
}
@end
@protocol logging
-(void)log;
@end
int main(int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
dog *loop=[[dog alloc] init];
//[dog setAge:6];
[dog log];
[pool drain];
return 0;
}
当我尝试运行此代码时,此程序给出错误“找不到用于记录的协议声明,为什么?