RAD Studio |  |

Using the TCustomVariantType Descendant
See Also
Collapse All

In the initialization section of the unit that defines your TCustomVariantType descendant, create an instance of your class. When you instantiate your object, it automatically registers itself with the variant-handling system so that the new Variant type is enabled. For example, here is the initialization section of the VarCmplx unit:

Copy Code

    initialization
    ComplexVariantType := TComplexVariantType.Create;

In the finalization section of the unit that defines your TCustomVariantType descendant, free the instance of your class. This automatically unregisters the variant type. Here is the finalization section of the VarCmplx unit:

Copy Code

    finalization
    FreeAndNil(ComplexVariantType);

See Also

Implementing Binary Operations

Implementing Comparison Operations

Implementing Unary Operations

Enabling Casting

Copying and Clearing Custom Variants

Loading and Saving Custom Variant Values

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!