iOS与设计模式五:模版方法模式
来源:互联网 发布:模拟人生4网络股票 编辑:程序博客网 时间:2024/05/20 00:39
多次出现,可重复使用的方法,可将其搬到父类中,子类就不必重复写这些代码,只需专心去实现差异性的代码。模版方法模式为代码提供了一个很好的复用平台。
@interface MySuperClass : NSObject@property (retain,nonatomic) NSString *aPropertyString; //这个属性都具备- (void)operationFirst;- (void)operationSecond;@end@implementation MySuperClass- (void)operationFirst{ }- (void)operationSecond{ NSLog(@"这个方法是通用的");}@end@interface ClassA : MySuperClass- (void)operationFirst;@end@implementation ClassA- (void)operationFirst{ NSLog(@"ClassA我需要实现我自己的方法");}@end@interface ClassB : MySuperClass- (void)operationFirst;@end@implementation ClassB- (void)operationFirst{ NSLog(@"ClassB我需要实现我自己的方法");}@end
- iOS与设计模式五:模版方法模式
- 设计模式学习笔记(五)模版方法模式
- 模版方法设计模式
- 模版方法设计模式
- 模版方法设计模式
- 模版方法设计模式
- 模版方法设计模式
- 设计模式-模版方法
- 设计模式--模版方法模式
- 设计模式 - 模版方法模式
- 设计模式---模版方法模式
- 【设计模式】模版方法模式
- 设计模式 模版方法模式
- 设计模式--模版方法模式
- 设计模式---- 模版方法模式
- 设计模式-模版方法模式
- 设计模式 - 模版方法模式
- 设计模式-模版方法模式
- X86汇编之debug用法
- Errors running builder 'DeploymentBuilder' on project ,myeclipse启动后报错,部署项目按钮不能用
- Android KeyCode列表
- Android中SQLite的陷阱
- hack工具大全
- iOS与设计模式五:模版方法模式
- 关于Delphi xe5 firemonkey 手机屏幕自适应程序问题
- 父类析构函数为非虚函数,子类为虚函数
- jquery mobile 中文资料 http://www.lampweb.org/jquerymobile/
- Android AutoCompleteTextView 实现历史记录提示
- VC中CFileDialog的基本操作
- Struts的标签和Struts的OGNL表达式(三)
- STL源码剖析:class template中拥有static data members
- kill -9