[Gambas-user] Arrays of Structs

Cam Era cybercamera at ...626...
Thu Dec 1 01:56:29 CET 2016


On Wed, Nov 30, 2016 at 5:27 PM, <nando_f at ...951...> wrote:

> I use structs to write binary to a file in struct order.
> Nice and easy.
> Not so easy with a class.
>
> Your example is possible.  I have done similar.
>
> The STRUCT only defines the structure...it doesn't create the memory
> allocation.
> Static Private WorldMap[100, 100] As MapObject  just defines arrays to
> point to objects.
> You need to run code to actually create new objects at each array element.
> hint:
> Loop  x
>  Loop  y
>    [x][y] = new MapObject  'the new actually creates a memory allocation
> for it.
>

Fernando,

good to know that it can be done using this approach if necessary.

Cheers

-- Cam



More information about the User mailing list