⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 singletonunit1.pas

📁 设计模式的源代码 Singleton模式
💻 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 + -