[Gambas-user] Array question
ron
ronstk at ...239...
Tue Oct 12 14:26:10 CEST 2004
On Tuesday 12 October 2004 13:41, Benoit Minisini wrote:
-----
I understand it correctly ?. FUNCTION Copy ( ) AS Variant[] Returns a
> > deep copy of the array.
> > Paolo
> >
>
> You are right and Ron is wrong. Copy() returns a deep copy of the array.
> But be careful: if there is an object reference in the array, then only the
> reference is copied. The object is not cloned (there is no clone support in
> Gambas object model).
>
> Regards,
>
Update:, While it didn't make sense to me I never used it
I use the function way.
I now made the code like next in a new prioject.
PUBLIC SUB btnOK_Click()
DIM hOld AS NEW Byte[]
DIM hNew AS NEW Byte[]
hold.Add(100)
hold.Add(200)
hold.Add(300)
PRINT hOld[0]
hOld[0] = 1
PRINT hOld[0]
hNew = hOld.Copy()
PRINT hOld[0], hNew[0]
hNew[0] = 2
PRINT hOld[0], hNew[0]
END
and results are:
100
1
1 1
1 2
So this isn't what your previous message told to Leo.
Sorry to the requestor, but I was set 'on false leg' as we say in dutch
by the answer to Leo, I did refer to this messages in my first answer.
More information about the User
mailing list