TSingleton Record

Definition

Provides a simple implementation of the Singleton Pattern . Use this portal to get the shared instance of a certain class which must have a default constructor.

It also keeps track of the lifetime of the instances and will free them in reversed order.

Delphi
type TSingleton = record

Remarks

This class just demonstrates how to apply the classical Singleton Pattern. It's recommended to use the Spring IoC container which is more flexible.

Constructors

Create
Destroy

Methods

GetInstance<T>

Gets the shared instance of a class.