Changing the Inheritance of a LabVIEW Class or Interface

By default, all LabVIEW classes and interfaces inherit from LabVIEW Object. To create classes that inherit from other classes, you must change the inheritance of a class. Complete the following steps to change the inheritance of a LabVIEW class.

  1. Create two new LabVIEW classes or interfaces or use existing classes or interfaces.
  2. Right-click the project item for the class or interface whose inheritance you want to change and select Properties from the shortcut menu.

    The Class/Interface Properties dialog box appears.
  3. Select Inheritance from the Category list.

    The Inheritance page displays the current inheritance of the LabVIEW class or interface. Skip to step 5 if you are changing the inheritance of an interface.
  4. Complete the following steps to change the parent class.
    1. Click the Change Parent Class button to display the Change Parent Class dialog box.
      In the All Classes in Project list, the diamond glyph indicates the current class whose inheritance you want to change.
      Note  The Change Parent Class button is not available for interfaces because interfaces always inherit from LabVIEW Object.
    2. Select the class from which you want the current class to inherit.
      Note  
      • A LabVIEW class cannot inherit from any of its descendants or from any classes that use the class as part of its private data. If you select a class in the All Classes in Project list that the LabVIEW class cannot inherit from, LabVIEW displays an invalid glyph next to the class.
      • Avoid inheriting one concrete class from an existing concrete class. Instead, create an interface or an abstract class as the common parent to both concrete classes. If you need to define state transitions for the concrete child classes, create an abstract class as the common parent. Otherwise, create an interface as the common parent.
    3. Click the Inherit From Selected button.
      LabVIEW returns to the Inheritance page of the Class/Interface Properties dialog box and updates the Parent Class Hierarchy.
  5. Complete the following steps to change the parent interfaces.
    1. Click the Change Parent Interfaces button to display the Change Parent Interfaces dialog box.
    2. Configure the parent interfaces by adding interfaces from the Available interfaces list or removing interfaces from the Inherit from these interfaces list.
      Note  A LabVIEW class or interface cannot inherit from any of its descendants. If you add an interface to the Inherit from these interfaces list that the class or interface cannot inherit from, LabVIEW displays an invalid glyph next to the interface.
    3. Click OK.
      LabVIEW returns to the Inheritance page of the Class/Interface Properties dialog box and updates the Parent Interfaces list.
  6. Click OK to save the inheritance configuration and close the Class/Interface Properties dialog box.