Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate an object at run time
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00625824
Message ID:
00625833
Views:
9
Hi,

>Is it possible duplicate an object, including all the object's properties, at run time?

No, that's not possible with a VFP function.

What comes to my mind (I've never done this) is to read the class out of the object, make a CREATEOBJECT() and copy all the properties to the newly created object.

I think this could work for incomplex objects, but be aware of things like aggregated objects (by simply copying property values, a reference to another object would point to the same object in the original object and the cloned objects). There will definately be some more pitfalls.

Armin

Armin Neudert
Regional Director (Stuttgart) of German FoxPro User Group dFPUG

MCP for Visual FoxPro

Expert/Editor of the VFP section in the German Codezone community portal
Previous
Reply
Map
View

Click here to load this message in the networking platform