gpt4 book ai didi

delphi重载程序

转载 作者:行者123 更新时间:2023-12-03 14:51:01 26 4
gpt4 key购买 nike

我想重载类中的过程。为此我写道:

type 

TMyClass = class(TObject)
private...
...
public
constructor create;
destructor destroy;
procedure dosomething(filename: string); overload;
procedure dosomething(s: string; t: string; u: string); overload;


implementation

procedure dosomething(filename:string);
begin
end;

procedure dosomething(s: string; t: string; u: string);
begin
end;

但是delphi告诉我一个关于前向或外部声明错误的错误...

这是为什么?

提前致谢!

最佳答案

您必须添加类名...

implementation   

procedure TMyClass.dosomething(filename:string);
begin
end;

procedure TMyClass.dosomething(s: string; t: string; u: string);
begin

end;

关于delphi重载程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5946840/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com