一、例如,我有一个StudyProtocol协议,学习协议,我还有一个Student类,这个类遵守了StudyProtocol协议
1.StudyProtocol.h文件如下:
#import
@protocol StudyProtocol < NSObject >
- (void)study;
- (void)qiaoCode;
@end
Student.h文件中:
#import
#import “StudyProtocol.h”
@interface Student : NSObject < StudyProtocol >
@end
Student.m文件中:
【协议Protocol的类型限制 Objective-C语言】
关注
打赏