Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to copy an object
Message
From
30/10/1998 05:36:20
James Beerbower
James Beerbower Enterprises
Hochheim Am Main, Germany
 
 
To
30/10/1998 05:31:18
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00152644
Message ID:
00152648
Views:
25
>>Is there some easy way to copy an object? Like ACOPY() but for objects? Simple assignment creates a reference to the object rather than an new instantiantion.
>>
>>Thanks in advance
>>
>>James Beerbower
>
>Maybe
>oObjectCopy = CREATEOBJECT(oOriginalObject.Class)
Unfortunately that create a new object with the default properties of the class not the properties of the original object:

oa = createobject('x')
oa.x = 'r'
ob = createobject(oa.class)
?ob.x
?oa.x

define class x as custom
x = 'd'
enddefine

But thanks anyways!

James Beerbower
Qsys
Deutschland
James Beerbower
James Beerbower Enterprises
Frankfurt, Deutschland
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform