Error 1448 Bad Type Cast With to More Specific Class in LabVIEW

Updated Jul 20, 2024

Reported In

Software

  • LabVIEW

Issue Details

  • I am trying to cast from a Parent class to a Child class in LabVIEW, but keep seeing error 1448 at run-time. Why is this?
  • When using the To More Specific Class function to cast from one class to another, LabVIEW reports the below error. What causes this?

Error 1448 occurred at To More Specific Class in <library name>.lvlib:<class name>.lvclass:<VI name>.vi

Possible reason(s):

LabVIEW: (Hex 0x5A8) Bad type cast.  LabVIEW cannot treat the run-time value of this LabVIEW class as an instance of the given LabVIEW class.

 

Solution

This error occurs when the run-time criteria for the To More Specific Class function are not met. At run-time, the class on the reference input must be either:
  • Of the type being cast to i.e. the same class type as the class on the target class input.
  • Or, a Child of the casted type i.e. a Child of the class on the target class input.
Ensure that the class on the reference input meets these requirements.

Additional Information

The To More Specific Class function will allow you to cast from a Child class to a Parent class, but not the other way around.
If you need to "cast" from a Parent class to a Child class, you must:
  • Create a new instance of the Child class.
  • Create an Accessor VI on the Parent class to allow the Child to access the Parent's data.