怎么用重载(overload)?
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,math;
type
TForm5 = class(TForm)
Button1: TButton;
function showmsg1(str:string):integer;overload;
function showmsg1(i:integer;str:string):integer;overload;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
{$R *.dfm}
{ TForm5 }
function TForm5.showmsg1(str: string): integer;
begin
result:=strtoint(str);
end;
function TForm5.showmsg1(i: integer; str: string): integer;
begin
result:=i+strtoint(str);
end;
procedure TForm5.Button1Click(Sender: TObject);
var I:integer;
begin
I:=showmsg1(5,'11')
end;
end.
以上代码出现错误提示(only one of a set of overloaded method can be published)