Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to make a copy of scattered name object
Message
De
13/08/2002 08:09:02
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00689032
Message ID:
00689054
Vues:
28
>Hi all,
>
>How can I make a copy of a scattered name object that isn't a reference to the original object?
>
>Eg:
>
>select mytable
>scatter name oData
>oTemp = oData && This only creates a reference. What I need is a copy!
>? oData.name
>> "Justin"
>oData.name = "Bon"
>? oTemp.name
>> "Bon" && This should still be "Justin"
>
>I haven't really got the time to create a proper data class. Any help would be greatly appreciated!

Justin,
I don't know of a direct way. This could help :
function myCloneObject
Lparameters toObject
Local loCopy, lnMembers
Local Array arrMembers[1]
lnMembers=Amembers(arrMembers,toObject)
Local Array arrStruc[lnMembers,4]
For ix=1 To lnMembers
  arrStruc[ix,1] = arrMembers[ix]
  arrStruc[ix,2] = 'L'
  arrStruc[ix,3] = 1
  arrStruc[ix,4] = 0
Endfor
Create Cursor dummy From Array arrStruc
Scatter Name loCopy
Use In 'dummy'
For ix = 1 To lnMembers
  loCopy.&arrMembers[ix] = toObject.&arrMembers[ix]
Endfor
Return loCopy
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform