Hi ,
I would ask how you would deal with OOP/UDT programming and arrays not pre-dimensioned (numbers of values are not known in advance and I would like to avoid declaring an oversized array) .

How would you program a basic SET / GET ?



here's my attempt: it is not functional
uses "console"

Type points
  x as currency
  y as currency
end type


type myfunction
  
  myarray() as points
  
  function setF(array1() as points)
    printl "inside myfunction.setF"
    
    redim me.myarray(ubound(array1)) 
    printl "ubound array1 = ", ubound(array1)
    printl "ubound me.myarray= ", ubound(me.myarray)
    
    string binary = peek$(varptr(array1(1)), CountOf(array1(1))*SizeOf(array1(1)))
    poke$(varptr(me.myarray(1)), binary)

    printl me.myarray(8).x, me.myarray(8).y
    printl ""
  end function
  
  'function getF() as points
  '  return me.myarray
  'end function
  
  Function getPointsNum() as integer
    return ubound(me.myarray)
  end function

  
end type


dim list1() as points
Dim list2() as points
dim test as myfunction

'...

Redim list1(12)
list1(8).x=3
list1(8).y=4

Printl "Setting values"
printl list1(8).x, list1(8).y
printl ""

test.setF(list1)

Printl "Getting values"
Redim list2(test.getPointsNum)
'list2= test.getF

'Printl list2(8).x, list2(8).y

Waitkey