Protocol 协议相关定义和操作方法
2014-12-19 13:48
162 查看
协议:
生活中:就业协议,劳务协议
计算机中: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");
}
*******************************************************
生活中:就业协议,劳务协议
计算机中: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");
}
*******************************************************
相关文章推荐
- 3GPP接口定义及相关协议一览
- ClientProtocol协议之上定义的方法
- MySQL_Internals_ClientServer_Protocol 客户端/服务器协议 相关文章
- Category 类别相关定义和操作方法
- 网络协议,端口定义等相关内容
- TCP/IP Protocol Suite(1)——协议定义及OSI模型
- RTP 与RTCP 解释. 含同步时间戳 RTP协议是real-time transport protocol的缩写,被设计来传输流媒体数据,有着广泛的应用,其它相关介绍自己去看RFC,我不打算
- php学习笔记 ------php中的错误定义和http相关协议仿盗链
- 3GPP接口定义及相关协议一, 手机通信专有名词中英文对照
- CBCentralManagerDelegate Protocol 委托协议相关分析
- 协议protocol相关笔记
- CBCentralManagerDelegate Protocol 委托协议相关分析
- @protocol协议定义和遵守
- 3GPP接口定义及相关协议一, 手机通信专有名词中英文对照
- WIFI协议(3) Definitions 之WIFI相关定义
- Object-C 协议 Protocol
- spice 协议相关分析总结
- HLS协议及java切片相关
- Java处理http协议相关初步(一)——httpclient
- Object-C学习笔记-Protocol(协议)与非正式协议