单元 unitA中有:
TFlowEngineImpl = class(TDataModule, IFlowEngine)
qryDispWorker: TSmartQuery;
qryProcinst: TSmartQuery;
.......查看IFlowEngine的定义如下:
在单元 unitB中
IFlowEngine = interface
function a()......
function b()......
function c()......
....但是在该单元的implementation部分没找到任何以上function的实现。
查找发现以上function的实现都在unitA的TFlowEngineImpl中声明并实现。我有两点不明白:
1.delphi好像不支持多继承,TFlowEngineImpl = class(TDataModule, IFlowEngine)
是不是表示多继承?如果不是,那是何意思?为什么要这么写?
2.interface是起到什么作用?以前没有涉及过这样的写法。
TFlowEngineImpl = class(TDataModule, IFlowEngine)
qryDispWorker: TSmartQuery;
qryProcinst: TSmartQuery;
.......查看IFlowEngine的定义如下:
在单元 unitB中
IFlowEngine = interface
function a()......
function b()......
function c()......
....但是在该单元的implementation部分没找到任何以上function的实现。
查找发现以上function的实现都在unitA的TFlowEngineImpl中声明并实现。我有两点不明白:
1.delphi好像不支持多继承,TFlowEngineImpl = class(TDataModule, IFlowEngine)
是不是表示多继承?如果不是,那是何意思?为什么要这么写?
2.interface是起到什么作用?以前没有涉及过这样的写法。
最好看看MSDN的介绍了http://lysoft.7u7.net
不是太懂。
接口可以多继承,子类必须实现完所继承的接口的方法。
interface其实是定义了一个接口,和class关键字是一样的意思,其实完整的应该是interface(IUnknown)
所有接口都继承IUnknown.
就是接口,与PUBLIC中的函数有些相似之处,但在OO的定义中不是同一个东西
它所定义的抽象方法.