📄 singletonunit1.pas
字号:
unit SingletonUnit1;
interface
uses SysUtils;
type
TSingleton = class
public
constructor Create; virtual;
destructor Destroy; override;
end;
var
Glob_Singleton1: TSingleton; //ㄏノ俱砰跑计
implementation
constructor TSingleton.Create;
begin
if Glob_Singleton1 <> nil then
abort
else
Glob_Singleton1 := Self;
end;
destructor TSingleton.Destroy;
begin
if Glob_Singleton1 = self then
Glob_Singleton1 := nil;
inherited Destroy;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -