@protocol ProtocolA <NSObject>
@end
@protocol ProtocolB <NSObject>
@end
@interface ClassB : NSObject <ProtocolB>
@end
@protocol ProtocolC <NSObject>
@end
@interface ClassC : NSObject <ProtocolC>
@end
@implementation ClassC
@end
{
Protocol *a = NSProtocolFromString(@"ProtocolA");
NSLog(@"%@", a);
Protocol *b = NSProtocolFromString(@"ProtocolB");
NSLog(@"%@", b);
Protocol *c = NSProtocolFromString(@"ProtocolC");
NSLog(@"%@", c);
}
运行结果:
2015-12-09 17:37:54.303 ProtocolTest[990:47869] (null)
2015-12-09 17:37:54.303 ProtocolTest[990:47869] (null)
2015-12-09 17:37:54.304 ProtocolTest[990:47869] <Protocol: 0x1012a02c0>
未实现
@implementation ClassC 实体的情况下,
打印出来是null