agoda上订房可靠吗:急!求教关于Delphi的一个问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 11:44:18
我写了一个Delphi程序,添加了一对重载过程之后出现了以下的编译错误:
only one of a set of overloaded methods can be published.
以下声明部分:
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
Button2: TButton;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
Label1: TLabel;
PrintDialog1: TPrintDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
function delnote(s: string):string;
procedure initia(out a: array of string; filename: string); overload;
procedure initia(out a: array of integer; filename: string); overload;
private
{ Private declarations }
public
{ Public declarations }
end;
这是为什么啊?
非常感谢!编译通过了!
不过我用Delphi2005做实验的时候也是把一对重载方法写在published段的,而且顺利通过了,为什么这段代码就不行呢?是不是版本的问题?我这里用的是Delphi7.

类的成员方法中, 位于published段的方法是不能有重名的, 也就是说不能采用重载的方法. 如果是在private或public段, 是可以的. 注意: 只是published 不可以

所以, 如果你把
procedure initia(out a: array of string; filename: string); overload;
procedure initia(out a: array of integer; filename: string); overload;
放到private或public中应该是可以的