unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
test = class
private
a: integer;
public
function x(y: integer): integer;
end;
var
Form1: TForm1;
implementation
constructor test.create;
begin
a:=0;
end;
function test.x(y: integer):integer;
begin
x:=a+y;
end;
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption := inttostr(function test.x(5));
end;
end.
|