You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Object by value help

2 replies [Last post]
Guest's picture

Hello i have a custom object I created and it i am trying to clone it with an identical object but it seems the object is by reference.

Here is just a sample of what I am doing to give you an idea possibly what I am looking for.

My object has one property that I can read and write to. (get set) named ID. It also has a constructor.

local myobject:myobject &oID = create myobject:myobject();

local myobject:myobject &oID2 = create myobject:myobject();


If i now check &oID.ID and &oID2.ID they are both set to "NOTCool". I assumed create would have created a new instance of my object but it is looking as though that is incorrect.

Any suggestions on how i might be able to make this work?


Guest's picture
Guest (not verified)
Re: Object by value help

May I know why you assigned:


I think the above statement causing both the objects point to same memory location.
correct me if i am wrong.

vivek6686's picture
User offline. Last seen 8 years 9 weeks ago. Offline
Joined: 09/27/2010
Posts: 8
Re: Object by value help

may be this could work