R
rejoise
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
function add(i:integer):integer;{位置1}
private
public
{function add(i:integer):integer
<位置2>
问题1.function 放在位置2与位置1有什么区别,不都是public公共函数吗?}
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
m:integer;
begin
m:=add(3);
button1.Caption:=inttostr(m);
end;
function TForm1.add(i:integer):integer;
{问题2,add函数前面为什么加Tform1,不加不能编译,我看有些原代码没加什么Tform1,到底怎么回事?}
begin
Result := 9;
end;
end.
{请大虾回答我的问题,谢谢了!}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
function add(i:integer):integer;{位置1}
private
public
{function add(i:integer):integer
<位置2>
问题1.function 放在位置2与位置1有什么区别,不都是public公共函数吗?}
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
m:integer;
begin
m:=add(3);
button1.Caption:=inttostr(m);
end;
function TForm1.add(i:integer):integer;
{问题2,add函数前面为什么加Tform1,不加不能编译,我看有些原代码没加什么Tform1,到底怎么回事?}
begin
Result := 9;
end;
end.
{请大虾回答我的问题,谢谢了!}