On Thu, 2012-02-23 at 09:09 +0100, Rolf-Werner Eilert wrote:
> That was it, Jussi, thanks a lot!
> 
> Here we can see what it is good for to know about OOP :-)
> 
> Regards
> 
> Rolf
> 
> Am 22.02.2012 18:49, schrieb Jussi Lahtinen:
> > Just quick thought... maybe this "felder = feld.Copy()" gives new object
> > reference feld to felder.
> > And because feld is declared locally, the it is null after the sub and so
> > is also felder.
> >
> > Perhaps you need to do "felder = feld.Copy()" manually with for each...
> >
> > Jussi
> >
> >
Interesting! I must admit that I have never used String[].Copy but I
would have expected that a "deep" copy meant that every string in the
array was copied to the target array, not just that a reference was
created.

So what is the difference between 
        felder=feld
and
        felder=feld.Copy
?

In the former case I would expect a reference but in the latter I would
have assumed a full transfer of the whole array replacing whatever was
in felder.

Further, within the example quoted by Rolf, if I explicitly copy every
string in feld to felder, viz
        Dim wkStr as String
        felder.Clear (or felder = New String[] **)
        for each wkstr in feld
                felder.Add(wkstr)
        next
will it work?

** the latter would be interesting, re-initialising a String[] array in
a called routine???

Bruce




------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to