unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TKzx=class //创建一个类
Name:String;
iYear:String;
Procedure ShowName; //声明一个普通方法
class Procedure ShowStr; //声明一个类方法
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Class Procedure TKzx.ShowStr ; ///实现类方法
begin
ShowMessage('大家好');
end;
procedure TKzx.ShowName ; //实现普通方法
begin
ShowMessage(Name);
end;
procedure ShowI(Const i;Var S:String);
begin
ShowMessage(s);
end;
procedure TForm1.Button1Click(Sender: TObject);
Var
Kzx:TKzx;
begin
Kzx:=TKzx.Create;
Kzx.Name:='Kzx';
Kzx.ShowName; //引用普通方面
Kzx.ShowStr; //引用类主法
TKzx.ShowStr; //直接调用类方法
end;
initialization
finalization
end.