Как создать массив полу-определенного типа данных


myobjectarray.png
' Gambas class file

arCar AS Object[]
blue AS CCar
green AS CCar

PUBLIC SUB _new()

blue = NEW CCar("blueCar", 300, 400.34)
green = NEW CCar("greencar", 100, 200.45)
arCar = NEW Object[]

arCar.Add(blue)
arCar.Add(green)

END

PUBLIC SUB Button1_Click()

i AS Integer
txt AS String
FOR i = 0 TO 1
txt = txt & arCar[i].getBrand() & "
"
NEXT
TextLabel1.Text = txt

END

-- JochenGeorges - 28 Dec 2004