Dynamic dispatching is the ability of a object-oriented program to execute a specific version of a VI at run time based on
the class of the object the VI accepts as an input. Using dynamic dispatch also removes the need to write diagram code to
select the classes that a VI can accept.
Class methods can have one of the following dynamic dispatch settings:
- Static Dispatch VI—A single VI defines the behavior for the entire class hierarchy. The compiler determines the version of the VI that executes
at run time.
- Dynamic Dispatch VI—The VI on the Member List of each class defines the specific VI behavior for the class. The dynamic dispatch input of the
VI determines the version of the VI to execute at run time.
Complete the following steps to create and configure methods in the same inheritance hierarchy to dispatch dynamically.
-
Open the Architecture view of the parent class, expand the Add member menu on
the Member List, and select VI from dynamic dispatch
template.
-
Open the parent class dynamic dispatch VI and configure the VI to fit your programming requirements.
-
Ensure that the dynamic dispatch VI meets the following requirements:
-
Access scope set to public or protected.
-
Contains only one dynamic dispatch input.

Note
The dynamic dispatch template automatically sets a dynamic dispatch input. To manually set a dynamic dispatch input, click
Edit icon, select the input, and select
Dynamic dispatch as the usage setting on the
Item tab.
-
Save the VI.
-
For each child class that requires a dynamic dispatch VI, open the Architecture
view of the child class, expand the Add member menu, and select
Override.
This option creates a dynamic dispatch VI that meets the following
requirements:
-
File name identical to the
parent class VI.
-
Connector pane identical to the
parent class VI.
-
Execution settings identical to
the parent class VI.
-
Access scope identical to the
parent class VI.
-
Save the VI.
-
Add the parent class dynamic dispatch VI to the diagram of the VI in which you want to execute dynamically.

Note
If you add the VI on the child class member list to the diagram, the VI cannot execute the version the parent class defines.
At run time, the class of the object the dynamic dispatch VI input receives determines which version of the VI executes.