unit UnitRegistry;{单元名}
interface
uses{相当于C语言的include}
Registry,Windows,Messages,Dialogs;
{公共函数申明,直接通过单元名调用}
procedure hello(str:string);
type {类定义开始}
OpRegistry=class
private
myRegistry:TRegistry;
public
{需要通过对象调用}
constructor Create();overload;
procedure DisplayMsg(str:string);
end;{类定义结束}
implementation
{
实现开始,包括类成员函数与公共函数
类成员函数实现 类名.函数名(过程名)
公共函数实现 函数名(过程名)
}
constructor OpRegistry.Create();
begin
myRegistry := TRegistry.Create;
end;
procedure OpRegistry.DisplayMsg(str:string);
var index:Integer;
begin
index:=index+1;
ShowMessage(str);
end;
procedure hello(str:string);
begin
ShowMessage(str);
end;
end.{实现结束}