Table Of Contents

Encapsulation of Class Fields and Methods

Last Modified: January 24, 2019

Encapsulation refers to the fact that a class is a single unit made up of class fields and the methods that can access those class field values. VIs not on the class member list have restricted access to encapsulated class fields.

Class fields have a private access scope setting. Only methods on the class member list for the G Type document can directly access and manipulate the value of a field on the Data view. Any VI not on the class member list must interface with a public access scope class method to interact with the data values of a class object on the diagram.

Restricting access to class data prevents your program from making unintentional changes to class fields and data values of specific class objects. The VI that interacts with the class object can use the class data on the diagram without directly accessing that data.

Grouping data and member VIs allows you to separate your code into clearly defined segments. Segmenting the code you write can prevent changes you make to one class method from causing issues in the other methods on the Member List of the class, or a VI external to the class. For example, to change the format of a class field, adjust the control on the Data view of the G Type document.


When you add class functionality to the G Type document, any pre-existing controls and indicators become encapsulated class fields.

Recently Viewed Topics