Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 5 Sequences & Scripting > 5.20 Object Oriented Programming

5.20.7 Private Member Variables (beta)

Scroll Prev Top Next More

Member variables of objects are, by default, visible from anywhere that has access to the reference to the object.  But sometimes you want member variables that really should only be accessed internally and you'd like to avoid accidentally accessing them from outside.  To do this you can declare your member variables as private by adding private to the declaration:

local private string someString = "abc"
local private someNumber = 5

Note that these member variables are only visible from within the object.  This means that you can't view their contents from anywhere, including the command / alert window.  Typically one will add set/get functions to then give access as needed.  

Note: private member variables are always transient, meaning they are never persisted by the ToJson() function (see below)