class constructors/destructors
Syntax
Class constructors are constructors/destructors that are called once when your program starts/finishes.
TSomeClass = class
private
  { new class constructor and destructor }
  class constructor Create;
  class destructor Destroy;
public
  { regular class instance constructor and destructor }
  constructor Create;
  destructor Destroy; override;
end;
Notes
  • Using these as an alternative to unit initialization/finalization clauses can result in smaller executables. This is because initialization/finalization clauses are always executed so the smart linker has no choice but to link in all the related classes. The smart linker is much better at eliminating unused classes when class constructors are used instead.
  • The VCL uses class constructor to ensure the gesturing framework is only included in applications that require it.
  • Class constructors/destructors will operate no matter what their visibility. Since they cannot be called explicitly from code, it is good practice to move them into the private section of your class to differentiate them from your regular instance constructors/destructors.
Further reading
Alex Ciobanu (Emb.) introduces class constructors and discusses a issue when using generics and class constructors.
http://alex.ciobanu.org/?p=258
Allen Bauer (Emb.) introduces class constructors and discusses how they're used in the VCL to prevent the gesturing framework being loaded unnecessarily.
http://blogs.embarcadero.com/abauer/2009/05/29/38888
Allen Bauer (Emb.) discusses the benefits and guidelines for usage of class constructors/destructors.
http://blogs.embarcadero.com/abauer/2009/09/03/38898
http://blogs.embarcadero.com/abauer/2009/09/04/38899