For example:
Code: Select all
objref src
src=new Vector(5,99)
func readvector() {
return $&1.x[3] // I want to have access to all other methods and properties of Vector()
}
print readvector(&src)
Thanks,
Pierre
Code: Select all
objref src
src=new Vector(5,99)
func readvector() {
return $&1.x[3] // I want to have access to all other methods and properties of Vector()
}
print readvector(&src)
Code: Select all
objref ab[2][3]
ab[0][0]=new Vector(10,0)
ab[0][1]=new Vector(10,01)
ab[0][2]=new Vector(10,02)
ab[1][0]=new Vector(10,10)
ab[1][1]=new Vector(10,11)
ab[1][2]=new Vector(10,12)
proc showvectors() { local i
for i=0,1 for j=0,2 print "$o1[",i,"][",j,"].x[5]=",$o1[i][j].x[5]
}
showvectors(ab)
Code: Select all
begintemplate O2d
public o
objref o[1][1]
proc init() {
objref o[$1][$2]
}
endtemplate O2d
Code: Select all
// small is good for initial tests
XSIZE = 2
YSIZE = 2
VECSIZE = 2
load_file("o2d.hoc")
objref ab
ab = new O2d(XSIZE, YSIZE)
for i = 0, XSIZE-1 {
for j = 0, YSIZE-1 {
ab.o[i][j] = new Vector(VECSIZE, i*10+j)
print i, j
ab.o[i][j].printf
print " "
}
}
print " "
print "//////// array of objrefs complete ////////"
print " "
print "//////// testing proc showvecs() ////////"
print " "
proc showvecs() { local ii, jj
for ii = 0, XSIZE-1 {
for jj = 0, YSIZE-1 {
print ii, jj
$o1.o[ii][jj].printf
print " "
}
}
}
showvecs(ab)