To More Generic Class Function
- 已更新2025-07-30
- 閱讀時間為 3 分鐘
Typecasts a reference, such as a control or a type definition, to a more generic class or interface in the inheritance hierarchy.
For example, if Class A inherits from Class B, the function upcasts a variable of type A to a variable of type B.
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 or interfaces.

Inputs/Outputs
target class
—
target class is the class or interface 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
—
reference is the refnum or LabVIEW class or interface to upcast.
generic class reference
—
generic class reference is the upcasted reference. If an error occurs, generic class reference is Not A Refnum. |
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 or interface 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 Facade VI refnum to reference and a VI refnum to target class to upcast from Facade VI to VI.
FPGA Module Details
The following details apply when you use this object in an FPGA VI.
| Single-Cycle Timed Loop | Supported. |
| Usage | N/A |
| Timing | This Cluster & Class function requires no clock cycles to execute because it does not include internal registers. |
| Resources | This Cluster & Class function consumes no FPGA resources because LabVIEW determines the actual class and creates a static reference before compiling the FPGA VI. |
target class
—
generic class reference
—