By Reference

BlitzMax Forums/BlitzMax Programming/By Reference

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.

you can pass objects by value or by refrence, and it does make a difference

Type tguy
	Field name$
End Type

Local joe:tguy
Global bob:tguy

joe=New tguy
joe.name="joe"

bob=New tguy
bob.name="bob"


change(joe)
Print joe.name

change2(joe)
Print joe.name


Function change(guy:tguy) 'does nothing
	guy=bob
End Function

Function change2(guy:tguy Var)
	guy=bob
End Function