Passing an instances name as a variable

BlitzMax Forums/BlitzMax Beginners Area/Passing an instances name as a variable

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.

Does something like this do the sort of thing that you need? Or were you wanting to pass a name$ ("Terra" in this example) rather than an instance name (Earth in this example)?
Strict


Type Planet

	Field Name:String

	Method GetName:String()
		Return Name
	End Method
	
End Type


Type Satellite

	Field Name:String


	Method SetOrbit( p:Planet )
		Print Name + " orbits " + p.GetName()
	End Method
	
End Type


Local Earth:Planet = New Planet
Earth.Name = "Terra"

Local Moon:Satellite = New Satellite
Moon.Name = "Luna"

Moon.SetOrbit( Earth )