Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to copy an Empty object to another one by value?
Message
From
01/06/2006 13:01:19
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/06/2006 04:52:13
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01126400
Message ID:
01126527
Views:
17
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
Previous
Reply
Map
View

Click here to load this message in the networking platform