生活中:就业协议,劳务协议
计算机中:http协议,udp协议,mail,telnet远程登录协议,ftp协议,usb1.0协议,usb2.0协议,usb3.0协议,spi协议,i2c协议
oc ios协议:方法的接口列表
//继承:子类继承父类的是变量跟方法,子类当中不需要实现继承过来的方法
//协议:能够被多个类共享方法接口,每个类在使用相关的方法的时候,需要自己去实现该方法,
每个类中的实现可能不同,但是方法的 的
*******************************************************
1.定制协议
//@protocol :定制协议
//Coder : 协议名
@protocol Coder <NSObject> //继承基协议
- (void)writeCode;
- (void)report;
- (void)debug;
@end
*******************************************************
2.遵守协议
@interface QFStudent : NSObject <Coder>
*******************************************************
3.实现协议
@implementation QFStudent
- (void)writeCode
{
NSLog(@“sdflaj");
}
- (void)report
{
NSLog(@“sdflaj");
}
- (void)debug
{
NSLog(@“sdflaj");
}
*******************************************************