unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure show(i : Integer);
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.show;
begin
ShowMessage(IntToStr(i));
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
show(1);
end;
show过程定义中,声明中有形参声明,但过程体中却不用声明形参。这种情况为什么Delphi能编译通过;但如果定义的是函数,按照类似的写法则无法通过。