An object is a collection of related data and the procedures that operate on the data.
As opposed to a traditional data array, objects can and normally do contain many different types of data. For example, the GPL Location Object that represents robot and part positions contains an array of Double values to store a position and orientation, an Integer value for special flag bits, a Boolean to indicate a choice of reference frames, a pointer to another object, plus other data. The values stored within an object are called “fields”. Generally, fields are accessed via “properties” of the object. The properties provide read and write access to field values and allow the values to be formatted, processed or grouped. Each field can have one, multiple, or no properties associated with it. For example, several properties of the Location Object access the same position and orientation field data to allow the data to be presented as individual axis positions or a set of all axes positions or a Cartesian position and orientation depending upon how the Location is defined.
From a data point of view, objects are similar to C structures. However, in addition to grouping data, objects also have specific procedures defined for operating on the object’s fields. These object-specific procedures are called “methods”. For example, the Location Object has methods for inverting its Cartesian position and for combining the positions of two Location Objects.
Depending upon how they are defined, some methods operate like subroutines while others return values like functions. If a method returns a value, it can be used in any expression that is appropriate for the type of its returned value. If a method operates like a subroutine, it must appear in a statement by itself and cannot appear within an expression. Either type of method can have a list of required arguments in the same manner as subroutines and functions.
More generally, fields, properties, and methods are referred to as “members” of an object or class. For the most part, you should only need to concern yourself with properties and methods of objects.