接口继承的问题(100分)

  • 主题发起人 主题发起人 first
  • 开始时间 开始时间
F

first

Unregistered / Unconfirmed
GUEST, unregistred user!
用type library生成一远程数据模块
TPooledRDM = class(TRemoteDataModule, IPooledRDM)
private
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
public
在另一个单元中继承远程模块的接口
TPooler = class(TAutoObject, IPooledRDM)
private
protected
function AS_ApplyUpdates(const ProviderName: WideString;
Delta: OleVariant;
MaxErrors: Integer;
out ErrorCount: Integer;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_GetRecords(const ProviderName: WideString;
Count: Integer;
out RecsOut: Integer;
Options: Integer;
const CommandText: WideString;
var Params: OleVariant;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_DataRequest(const ProviderName: WideString;
Data: OleVariant): OleVariant;
safecall;
function AS_GetProviderNames: OleVariant;
safecall;
function AS_GetParams(const ProviderName: WideString;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_RowRequest(const ProviderName: WideString;
Row: OleVariant;
RequestType: Integer;
var OwnerData: OleVariant): OleVariant;
safecall;
procedure AS_Execute(const ProviderName: WideString;
const CommandText: WideString;
var Params: OleVariant;
var OwnerData: OleVariant);
safecall;
end;
在IPooledRDM接口中添加一个方法,如
TPooledRDM = class(TRemoteDataModule, IPooledRDM)
private
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
procedure Method1;
safecall;//新添加的方法
public
end;
继承类如下
TPooler = class(TAutoObject, IPooledRDM)
private
protected
function AS_ApplyUpdates(const ProviderName: WideString;
Delta: OleVariant;
MaxErrors: Integer;
out ErrorCount: Integer;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_GetRecords(const ProviderName: WideString;
Count: Integer;
out RecsOut: Integer;
Options: Integer;
const CommandText: WideString;
var Params: OleVariant;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_DataRequest(const ProviderName: WideString;
Data: OleVariant): OleVariant;
safecall;
function AS_GetProviderNames: OleVariant;
safecall;
function AS_GetParams(const ProviderName: WideString;
var OwnerData: OleVariant): OleVariant;
safecall;
function AS_RowRequest(const ProviderName: WideString;
Row: OleVariant;
RequestType: Integer;
var OwnerData: OleVariant): OleVariant;
safecall;
procedure AS_Execute(const ProviderName: WideString;
const CommandText: WideString;
var Params: OleVariant;
var OwnerData: OleVariant);
safecall;
procedure Method1;
safecall;
end;
为什么编译是不能通过
报如下错误:[Error] pooler.pas(32): Unsatisfied forward or external declaration: 'TPooler.Method1'
 
TPooler没有实现'TPooler.Method1'?
 
这是因为在Pooler.pas单元中的实现部分(implementation)没有为Method1写代码。
在Method1位置按ctrl-Shift-C,DELPHI编辑器帮你生成需要的代码了。
另:这个不是关于接口继承的问题
 
szf是不是这里的斑竹啊?看你经常回答别人的问题
想和你交个朋友,确切的说,想向你学很多东西啊:)
qq,28575640
 
多人接受答案了。
 
后退
顶部