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

To More Generic Class

LabVIEW 8.2 Help
August 2006

NI Part Number:
371361B-01

»View Product Info
Download Help (Windows Only)

Typecasts a reference, such as a control or a type definition, to a more generic class in the inheritance hierarchy. For example, if Class A inherits from Class B, the function downcasts a variable of type A to a variable of type B.

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

Details  

target class is the class to which you want to upcast 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 upcast.
generic class reference is the upcasted control reference. If an error occurs, generic class reference is Not A Refnum.

To More Generic Class Details

This function does not have error in and error out parameters because LabVIEW can determine at edit time whether you have wired the reference to a compatible target class. If you wire the reference to an incompatible target class, the wire breaks and you receive a Class conflict error.

You can use the To More Generic Class function to manipulate the properties or methods from a more generic class than that of the reference. For example, you can wire an enum control reference to the To More Generic Class function to upcast the reference to the Numeric class. You then can manipulate the Numeric class properties of the control, but you no longer can access the specific properties of the Enum class.

Wire a FacadeVI refnum to reference and a VI refnum to target class to upcast from FacadeVI to VI.


Resources

WAS THIS ARTICLE HELPFUL?

Not Helpful