RAD Studio VCL Reference
OleVariant Class

System::OleVariant is a C++ implementation of the Delphi intrinsic type System::OleVariant.

OleVariant = class(Variant);
class OleVariant : protected Variant;

System::OleVariant is a special descendant of the Variant class that is used to represent COM interfaces or data that is passed over a COM interface. System::OleVariant inherits from Variant as a protected class so that it can prevent operations on AnsiString objects, which are not compatible with COM. 

The syntax for using System::OleVariant is the same as that for using the Variant class. Like the Variant class, System::OleVariant has the following characteristics: 

System::OleVariants can contain integer values, real values, string values, boolean values, date-and-time values, and Automation objects. In addition, System::OleVariants can contain arrays of varying size and dimension with elements of any of these types. 

The special System::OleVariant value Unassigned is used to indicate that a System::OleVariant has not yet been assigned a value, and the special System::OleVariant value Null is used to indicate unknown or missing data. 

A System::OleVariant can be combined with other System::OleVariants and it can be constructed from any of the following data types. The compiler automatically performs the necessary type conversions. 








When an System::OleVariant contains an Automation object, the System::OleVariant can be used to get and set properties of the object, and to invoke methods on the object. 

System::OleVariant variables are always initialized to be Unassigned when they are first created. This is true whether a System::OleVariant variable is global, local, or part of a structure such as an array. 

Note that while System::OleVariants offer great flexibility, they also consume more memory than regular variables, and operations on System::OleVariants are substantially slower than operations on statically typed values.

Note: Use only the operators declared within System::OleVariant. The compiler will ignore any operators you overload yourself.
Note: For binary operators, if one operand is of type System::OleVariant, the other operand is automatically converted to type System::OleVariant.


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