Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

To More Specific Class Function

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

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 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.

Details  Example

target class is the class 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 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 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, wire the data value reference of the target class to target class.


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.


 Was this document helpful?  submit
  Helpful Not Helpful