Table of Contents

TObjectFactory Class

Default implementation of IObjectFactory that uses RTTI to find and invoke a parameterless constructor.

Remarks

The factory searches the class hierarchy for a constructor with no parameters and invokes it to create the instance. If no parameterless constructor is found, CreateInstance returns nil.

Syntax

Unit: Bcl.Rtti.ObjectFactory

TObjectFactory = class(TInterfacedObject, IObjectFactory);

Methods

Name Description
CreateInstance Creates a new instance of the specified class by invoking its parameterless constructor via RTTI.