unit Unit2; interface uses System.SysUtils; type { TSingle } TSingle = class(TObject) private FStr: string; protected public constructor Create; class function GetInstance(): TSingle; class function NewInstance: TObject; override; procedure FreeInsta…
unit Singleton; (* 单例模式适用于辅助类, 一般伴随于单元的生命周期 *) interface uses SysUtils; type TSingleton = class public class function NewInstance : TObject; override; class function GetInstance : TSingleton; destructor Destroy; override; procedure FreeInstance; over…