[Gambas-user] How to clone an object?

Jussi Lahtinen jussi.lahtinen at gmail.com
Thu Apr 23 23:48:07 CEST 2020


See this if you are interested in the partial solution.
http://gambas.8142.n7.nabble.com/Code-for-object-serialization-td41197.html


Jussi

On Fri, Apr 24, 2020 at 12:43 AM Jussi Lahtinen <jussi.lahtinen at gmail.com>
wrote:

> Object.Class() returns the class of the given object, which can be used
> for this... partially.
> However, if you need full serialization, IE clone also private values of
> the objects. You need example from Benoit. As it is implemented only
> recently and I haven't seen any documentation for it.
>
>
> Jussi
>
>
>
> On Fri, Apr 24, 2020 at 12:20 AM martin p cristia <tercoide at hotmail.com>
> wrote:
>
>> I want a clone an object I dont know what Class it is.
>>
>> Public <http://gambaswiki.org/wiki/lang/public> c1 as
>> <http://gambaswiki.org/wiki/lang/as> New
>> <http://gambaswiki.org/wiki/lang/new> Clase1                    ' These
>> classes may have arrays of other classes Object[]
>> Public <http://gambaswiki.org/wiki/lang/public> c2 as
>> <http://gambaswiki.org/wiki/lang/as> New
>> <http://gambaswiki.org/wiki/lang/new> Clase2                   ' All
>> diffent
>> Public <http://gambaswiki.org/wiki/lang/public> c3 as
>> <http://gambaswiki.org/wiki/lang/as> New
>> <http://gambaswiki.org/wiki/lang/new> Clase3
>> Public <http://gambaswiki.org/wiki/lang/public> c4 as
>> <http://gambaswiki.org/wiki/lang/as> New
>> <http://gambaswiki.org/wiki/lang/new> Clase4
>>
>>
>> ' at this point we don't know
>> Public <http://gambaswiki.org/wiki/lang/public> Function
>> <http://gambaswiki.org/wiki/lang/sub> ClonMe(original as
>> <http://gambaswiki.org/wiki/lang/as> Object
>> <http://gambaswiki.org/wiki/lang/type/object>) as
>> <http://gambaswiki.org/wiki/lang/as> Object
>> <http://gambaswiki.org/wiki/lang/type/object>
>>
>> ' a New object of the same kind with all variables/properties and
>> constants with the same values
>> ?????
>>
>> End <http://gambaswiki.org/wiki/lang/end>
>>
>>
>> --
>> Saludos
>>
>> Ing. Martin P Cristia
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200424/d1c30b0d/attachment.html>


More information about the User mailing list