how to make an instance equal to another

BlitzMax Forums/BlitzMax Programming/how to make an instance equal to another

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I create a "Deep Clone" of mine:
Type TVector
	Field xcomponent:Double, ycomponent:Double

	Method deepClone:TVector()
		Local myVector:TVector = New TVector
		myVector.xcomponent = xcomponent
		myVector.ycomponent = ycomponent
		Return myVector
	End Method
End Type
then you just invoke it as if you where creating a new object:
myVectorAClone = myVectorA.deepClone()
Idealy such behaviour should be determined by an Interface, but BlitzMax sadly doesn't have those.

This works in much the same way as the technique above, except it makes it somewhat simpler to make a copy of composite objects (objects that contain other objects), providing they also have a deepClone method (which you could have enforced with an Interface).