READONLY

READONLY data fields may be read any function, but may not be modified by any function except methods (member functions) defined on the class. READONLY data fields are specified by enclosing their definitions between the keywords ReadOnly and EndReadOnly.

For example, the following definition of the Circle class will make the Radius and Area fields readonly:

DEFINE CLASS Circle
  double CenterX
  double CenterY
  ReadOnly
    double Radius
    double Area
  EndReadOnly
ENDDEFINE

With this new definition, the CenterX and CenterY fields are still public and can be read and modified by any function:

local Circle c
c.CenterX = 5
print c.CenterX

Since the Radius and Area are ReadOnly, they can be printed, and used in assignments and expressions

print c.Area
local double SphereVolume
SphereVolume = 4/3 * 3.142 * c.Radius^3

However, they can not be directly assigned to. The following statement would result in an error:

c.Radius = 3.0

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.