我有一个数据模块(TfDB),我想将此函数添加到其中
Function GetZone(zone :string):string;当我尝试运行它时,我得到了这个错误...外部声明的未满足转发: TfDB.GetZone
unit MyDataModule;
interface
uses
System.SysUtils, System.Classes, Data.DB, Data.Win.ADODB;
type
TfDB = class(TDataModule)
dbconnection: TADOConnection;
private
{ Private declarations }
public
Function GetZone(zone :string):string;
end;
var
fDB: TfDB;
implementation
{%CLASSGROUP 'System.Classes.TPersistent'}
{$R *.dfm}
Function GetZone(zone:string):string;
begin
if zone = 'FLayout1' then
result := '1';
if zone = 'FLayout2' then
result := '2';
if zone = 'FLayout3' then
result := '3';
if zone = 'FLayout4' then
result := '4' ;
if zone = 'FBoneYard' then
result := 'BoneYard';
if zone = 'FShop' then
result := 'shop';
if zone = 'FMisc' then
result := 'Misc' ;
end;
end.发布于 2013-01-20 19:56:13
在实现部分中,您需要将函数声明为类的方法:
function TfDB.GetZone(zone:string):string;
begin
....
end;您的声明如下所示:
function GetZone(zone:string):string;
begin
....
end;这定义了一个独立的函数,而不是类的方法。
https://stackoverflow.com/questions/14424240
复制相似问题