Table Of Contents

Creating a Class

Last Modified: August 6, 2018

Use a G Type document with class functionality to define the fields and methods of a class. A class object on the diagram of a VI can have a specific value for each field and can perform each method on the class G Type document.


You cannot remove class functionality after you add it to a G Type document. //Pretty sure we will be able to on this rev// Compare the fields and methods of the class you want to create with that of other classes in your project to avoid duplicating code.

Complete the following steps to create a class using a G Type document.

  1. From the Project Files tab, use the New menu to create a Class G Type document.
  2. To add a class field, add a control or indicator to the Data view of the class G Type document.
  3. To add a class method, drag a file from the Project Files tab onto the Member List of the class G Type document or click Add member on the G Type document toolbar to select a template to use as a starting point.
    Option Description
    VI for data member access Create an interface that other parts of your program can use to read or write to a class field.

    You can only create a VI for data member access if a control or indicator is present on the Data view of the class G Type document.

    VI from dynamic dispatch template Create a version of a VI specific to the class. The program chooses the version of the VI to execute at run time based on the object the VI input accepts.
    VI from static dispatch template Create a VI that has the same functionality for all class objects it accepts.
    VI for override Create a VI that overrides a method on the Member List of a parent class in your project.

    The option to create a VI for override is available only when the Member List of the parent class contains a valid member VI to override.

    Blank VI Create an empty VI for the class.
    Class Property Create a property that can use VIs you create to access fields on the Data view.

Recently Viewed Topics