摘要: 对象合成:通过获得对其它对象的引用而在运行期动态定义的。在一个新的对象里面使用一些已有的对象,使之成为新对象的一部分,新的对象通过向这些对象的委派责任达到复用已有功能的目的。以策略模式举例:type TStrategy=class(TObject)//抽象策略 public procedure Hello;virtual;abstract; end; TConcreteStrategyA=class(TStrategy)//具体策略A public procedure Hello;override; end; TConcreteStrategyB=class(TStrategy)//具体策.. 阅读全文
posted @ 2008-03-14 13:02 delphi中间件 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 以类的适配器模式为例:type ITarget=interface//目标 procedure Hello; Procedure Hello2; end; TAdaptee=class(TInterfacedObject)//被适配者一 public procedure Say; end; TAdaptee2=class(TInterfacedObject)//被适配者二 public procedure Tell; end; TAdapter=class(TAdaptee,ITarget)//适配器(多重继承) public procedure Hello; procedure ... 阅读全文
posted @ 2008-03-14 13:01 delphi中间件 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 宽接口:IInterFace1=interface //方法列表end;窄接口:对象接口,接口声明和类相似,但不能直接实例化,也不能自己实现它们的方法,而是由支持接口的类来提供实现。type TStrategy=class(TObject)//抽象策略 public procedure Hello;virtual;abstract; end; TContext=class(Tobject)//上下文 private FStrategy:TStrategy;//引用已有的对象(窄接口) Procedure SetStrategy(Value:TStrategy); public proc... 阅读全文
posted @ 2008-03-14 12:59 delphi中间件 阅读(542) 评论(0) 推荐(0) 编辑
摘要: {*******************************************************}{ }{ 命令模式的简化 }{ }{ 版权所有 (C) 2008 陈新光 }{ }{*******************************************************}...type TFormHycx = class(TForm... 阅读全文
posted @ 2008-03-14 12:58 delphi中间件 阅读(241) 评论(0) 推荐(0) 编辑
摘要: {*******************************************************}{ }{ 业务逻辑一 }{ }{ 版权所有 (C) 2008 陈新光 }{ }{*******************************************************}unit Hello1;interfaceuses Dialo... 阅读全文
posted @ 2008-03-14 12:56 delphi中间件 阅读(205) 评论(0) 推荐(0) 编辑
摘要: {*******************************************************}{ }{ ADO数据工厂 }{ }{ 版权所有 (C) 2008 咏南工作室 }{ }{*******************************************************}unit uDataFactory;interfaceuses SysUtils,ADODB,DB,Classes,uCommFunc,ActiveX;{ 生成连接对象 }function GetADOConn(Owner:TComponent;AProvider:Integer=1) 阅读全文
posted @ 2008-03-14 12:54 delphi中间件 阅读(251) 评论(0) 推荐(0) 编辑