We'll dive straight in with this first example, and define an object and use it. Object definitions are global and must be made before any procedure definitions.
OBJECT rec tag, check table[8]:ARRAY data:LONG ENDOBJECT PROC main() DEF a:rec a.tag:=1 a.check:=a a.data:=a.tag+(10000*a.tag) ENDPROC
This program doesn't visibly do anything so there isn't much point in compiling it. What it does do, however, is show how a typical object is defined and how elements of an object are selected.
The object being defined in the example is rec
, and its elements are defined just like variable declarations (but without a DEF
).
There can be as many lines of element definitions as you like between the OBJECT
and ENDOBJECT
lines, and each line can contain any number of elements separated by commas.
The elements of the rec
object are tag
and check
(which are LONG
), table
(which is an array of CHAR
with eight elements) and data
(which is also LONG
).
Every variable of rec
object type will have space reserved for each of these elements.
The declaration of the (local) variable a
therefore reserves enough memory for one rec
object.
Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.