How to Configure Dynamic Dispatch in LabVIEW

Updated Jan 30, 2020

Reported In

Software

  • LabVIEW

Issue Details

  • I wish to use Dynamic Dispatch to have a child class override a parent method in LabVIEW.
  • I want to link a child class to a parent class and configure my VI's for Dynamic Dispatch 
  • I am modifying a class but my child class VIs are broken and when I click the broken arrow I get a This VI attempts to ovverride a static VI in an ancestor class error, with the following message.
This VI attempts to override a static VI in an ancestor class. An ancestor class has a VI by the same name that does not have a dynamic dispatch input terminal. Only dynamic member VIs can be overridden in child classes. To correct this, change the name of this VI so that it does not match any ancestor VI names or edit the ancestor to include a dynamic dispatch input terminal.

 

Solution

To implement Dynamic Dispatch, ensure that the child class is correctly inherited by the parent class:
1.- Right click the child class and click the Properties option.
2.- Go to the inheritance category and select Change Inheritance...
3.- Select the parent class to inherit and click Inherit from Selected.
4.- Click OK to exit the properties dialog.
5.- Right click the parent class and click New, VI From Dynamic Dispatch Template... 
6.- Implement the functionality of the parent class method in case it should have any.
7.- Make sure all VIs and classes are saved to disk.
8.- Right click the child class and click New, VI for Override...
9.- Implement the functionality for the overriding method.

Additional Information

Refer to the LabVIEW Object-Oriented Programming FAQ for more information on LabVIEW Object Oriented Programming.