Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Copy a Object ??
Message
 
À
30/08/1999 20:32:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00258802
Message ID:
00259801
Vues:
19
>Basically, this is impossible to be done safely, because:
>1. There may be private/protected properties that you cannot access.
>2. There may be accessor methods for some/all properties. While this is not a problem directly, the order you'll use to copy the properties determines the execution order for the accessor methods. The code inside these methods may behave differently depending on the value of other properties, etc, etc. I'm sure you got the idea...
>
>But this can be a good item for the wish list. Before that, try to decide yourself on the following problem: when an object is copied, should the owned objects (properties that hold references to other objects) be copied or linked to the new object. This is the most difficult problem, IMHO. If the objects are copied, you may end with infinite loops and other problems. If the objects are only linked to the new object, you may never know who holds references to what objects and, as you know, this is a very ugly problem in VFP.
>
>Vlad
>
>>x=Thisform
>>
>>Holds a object reference for that object but how I can make a seperate copy of object...something like..
>>
>>x=Copyof(Thisform)

How about just assigning the object to another variable? For example..

x=createobject('form')
y = x

Even if you release x, y will still have a reference to the object. Or you could trying something like...

x=createobject('form')
y=createobject(x.class)

or

x=createobject('form')
y=newobject(x.class, x.classlibrary)

Michael G. Emmons
memmons@nc.rr.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform