To More Specific Class Function

Owning Palette: Application Control VIs and Functions

Requires: Base Development System

Typecasts a reference, such as a control or a type definition, to a more specific class or interface in the inheritance hierarchy.

For example, if Class A inherits from Class B, a variable of type B can hold a value of type A. You can use the function to downcast from type B to type A. If the typecast is invalid, this function returns an error at run time.

You can use the To More Specific Class function for casting any class hierarchy in LabVIEW, including VI Server refnums, .NET/ActiveX refnums, and LabVIEW classes or interfaces.

Details  Example

 Add to the block diagram  Find on the palette
target class is the class or interface to which you want to downcast reference. You can wire a class specifier constant or any wire of the target type to this input.
reference is the refnum or LabVIEW class or interface to downcast.
error in describes error conditions that occur before this node runs. This input provides standard error in functionality.
specific class reference is the downcast reference. If the target class is incompatible with the reference, the function returns an error and specific class reference is Not A Refnum.
error out contains error information. This output provides standard error out functionality.

To More Specific Class Details

You can use the To More Specific Class function to manipulate the properties or methods from a more specific class or interface than that of the reference. For example, if you build an array of references to boolean, numeric, and string controls, LabVIEW casts these references to the more generic Control class because an array can contain only one data type, and each of these controls is a member of the Control class. If you then want to manipulate the properties for only the boolean controls in the array, you can create a reference to the array and use the To More Specific Class function to downcast the array reference to the Boolean class.

Wire a VI refnum to reference and a Fa�ade VI refnum to target class to downcast from VI to Fa�ade VI.

You also can use data value references to downcast classes. The To More Specific Class function waits to execute until the reference is available for downcast. To downcast a class or interface, wire the data value reference of the target class or interface to target class.

Related Information

Casting LabVIEW Classes

Example

Refer to the To More Specific Class VI in the labview\examples\Application Control\VI Server\To More Specific Class directory for an example of using the To More Specific Class function.

 Open example  Find related examples