type : copy an occurence

BlitzMax Forums/BlitzMax Beginners Area/type : copy an occurence

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'm not sure how safe this is..
SuperStrict

Type TType
	Field ID$ , x% , y%
	
	Function Copy:TType(other:TType)
		
		Local cu:TType = New TType
		
		MemCopy(cu , other , SizeOf(TType) )
		
		Return cu
		
	End Function
End Type

Local a:TType = New TType
a.x = 10
a.y = 100
a.ID = "ONE"
Print "A"
Print a.ID
Print a.x + ", " + a.y
Print "Copying to B"
Local b:TType = TType.Copy(a)
Print "B"
Print b.ID
Print b.x + ", " + b.y
Print "Changing B..."
b.x = 20
b.y = 200
b.ID = "TWO"
Print "A"
Print a.ID
Print a.x + ", " + a.y

Print "B"
Print b.ID
Print b.x + ", " + b.y


but it seems to work, mabey someone with better lowlevel knowlage can help more?