Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to copy an Empty object to another one by value?
Message
De
01/06/2006 13:01:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/06/2006 04:52:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01126400
Message ID:
01126527
Vues:
23
This message has been marked as the solution to the initial question of the thread.
>Weird,the outcome is always by reference...
>
>SET UDFPARMS TO VALUE
>CREATE CURSOR  tmp (a c(10),b c(10))
>INSERT INTO tmp values("aaaaa","bbbbb")
>SCATTER MEMO  name otmp ADDITIVE
>?otmp.a  && showing "aaaaa"
>otmp2=otmp
>?otmp2.a && showing "aaaaa"
>otmp.a="11111"
>?otmp2.a && showing "11111"  ?!
>otmp2.a="22222"
>?otmp.a  && showing "22222" ?!
>
It's normal you have reference to the same object.
Create Cursor  tmp (a c(10),b c(10))
Insert Into tmp Values("aaaaa","bbbbb")
Scatter Memo Name otmp Additive
?otmp.a  && showing "aaaaa"
otmp2 = CopyEmpty(oTmp)
?otmp2.a && showing "aaaaa"
otmp.a="11111"
?otmp2.a && showing "11111"  ?!
otmp2.a="22222"
?otmp.a  && showing "22222" ?!

Procedure CopyEmpty(toEmpty)
	Local oCopy,ix
	oCopy = Createobject("Empty")
	For ix= 1 To Amembers(aObjProp,toEmpty)
		AddProperty(oCopy,aObjProp[m.ix],Evaluate("toEmpty."+aObjProp[m.ix]))
	Endfor
	Return oCopy
endproc
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
Répondre
Fil
Voir

Click here to load this message in the networking platform