This is really a memory management question I suppose. Custom types, as I understand them, are sort of like linked lists. Everytime I use the New command to create one, it appends my object to a list of ones already created.
My question is about declaring and copying and destroying these types. So for this situation:
1) myThing.MyType = New MyType
2) myOtherThing.MyType = New MyType
3) myThing = myOtherThing
4) delete myOtherThing
It seems to me that line one is not needed. I would guess that myThing is just a pointer, and the New allocates the space, so that line three points the pointer elsewhere, and the space allocated in line one is ignored.
Is that the case? Will the delete in line 4 delete the allocated memory that both myThing and myOtherThing point to? Or does line 3 copy the memory to some new location?
My question is about declaring and copying and destroying these types. So for this situation:
1) myThing.MyType = New MyType
2) myOtherThing.MyType = New MyType
3) myThing = myOtherThing
4) delete myOtherThing
It seems to me that line one is not needed. I would guess that myThing is just a pointer, and the New allocates the space, so that line three points the pointer elsewhere, and the space allocated in line one is ignored.
Is that the case? Will the delete in line 4 delete the allocated memory that both myThing and myOtherThing point to? Or does line 3 copy the memory to some new location?