Hello,
I would like to create a second instance of a type variable and then copy the contents of of the first instance of that type variable to the second. I don't want to copy a reference to the first instance, I want to actually create a new variable instance that contains the same data.
Erel has and example in B4A using KeyValueStore. Is this available in B4J?
For example:
Is there a way to do this other than writing a special function CopyTheDataFrom?
Thanks,
Barry.
I would like to create a second instance of a type variable and then copy the contents of of the first instance of that type variable to the second. I don't want to copy a reference to the first instance, I want to actually create a new variable instance that contains the same data.
Erel has and example in B4A using KeyValueStore. Is this available in B4J?
For example:
B4X:
Type MyPoint (l, t as Int)
Dim P1, P2 as MyPoint
P1.Initialize
P1.l = 5
P1.t = 10
P2.Initialize
P2 = CopyTheDataFrom(P1)
' if I do P2 = P1, P2 gets a reference to P1
' if I set P2.l = 7, P1.l would also be 7
Is there a way to do this other than writing a special function CopyTheDataFrom?
Thanks,
Barry.