Using 3d Vectors as an example; the vectors can be added, subtracted, multiplied and divided like simple numbers.
An array of vectors defined like this is contiguous and can be passed by reference to other systems like Opengl which are not Object-aware.
'=====================
'OPERATORS FOR OBJECTS
'VECTOR DEMO
'=====================
type vec3d double x,y,z
'===========
class vector
'===========
'
private
'
static vec3d v[16] 'ACCUMULATOR STACK
static sys idx,pp 'INDEXES AND POINTERS
static vec3d *d '
static vec3d *s '
'
public
'
vec3d
'
'
method constructor()
'===================
end method
'
method destructor()
'==================
end method
'
method mapio()
'==============
&d=&v+idx*sizeof vec3d 'accum (location in stack)
if pp then
&s=&d+sizeof(vec3d) 'read from stack (1 up from accum)
pp=0
else
&s=&x 'read object x,y,z values
end if
end method
'
method "push"()
'==============
++idx
end method
'
method "pop"()
'==============
--idx
pp=1
end method
'
method "load"()
'==============
mapio()
copy &d,&s,sizeof vec3d
end method
'
method "="()
'==============
mapio()
copy &s,&d,sizeof vec3d 'copy to object x,y,z
end method
'
method "+"()
'===========
mapio()
d.x+=s.x : d.y+=s.y : d.z+=s.z
end method
'
method "-"()
'===========
mapio()
d.x-=s.x : d.y-=s.y : d.z-=s.z
end method
'
method "*"()
'===========
mapio()
d.x*=s.x : d.y*=s.y : d.z*=s.z
end method
'
method "/"()
'===========
mapio()
d.x/=s.x : d.y/=s.y : d.z/=s.z
end method
'
end class
'====
'MAIN
'====
vector v1[10]
vector v2
vector v3
v1[1]<=10,20,30
v2<=2,2,2
v3<=3,3,3
'VARIOUS EXPRESSIONS USED FOR TESTING
'v1=v2
'v1=v3
'v1=v2+v3
'v1=(v2+v3)
'v1[1]=(v2+v3)
'v1=v1*(v2+v3)
'v1[2]=v1*(v2+v3)+v1
'v1+=v1*(v2+v3)+v1
'
'v1[2]+=v2[1]+v3[1]
'v1[1]=v2[1]+(v3[1]-v1)
v1[1]=v2[1]+v3[1]*v1[1]
string cm=" , "
print "V1[n]=" v1[1].x cm v1[1].y cm v1[1].z
'print structureof vector
Charles