[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class internals


>
>
> If I create a Class that depicts something like a shape for 3D drawing
> and add some Functions to it, when replicated for thousands or millions,
> all is copied or just the fields/properties? Like:
>
> ' some  code
>
> Public shapes as New Shape[]
>
> Public s as Shape
>
> For i=1 to 1000000
>
>     s = New Shape
>
>     shapes.Add(s)
>
> Next
>
>
> 'Class Shape
>
> Public vertex as Float[]
>
> Public Id as Integer
>
>
> ' is this code created once or for every Shape object?
>
> Public Function Draw(s as Shape)
>
> . ' code for doing things
>
> End
>
>
> Public Function SaveShape(s as Shape)
>
> ' cpde for saving shape on disk
>
> End
>
>

If you use "static" keyword, then the functions apply to all Shape objects
and AFAIK are not created in memory for all objects.


Jussi