Method New

BlitzMax Forums/BlitzMax Beginners Area/Method New

mothmanbr(Posted 2007) [#1]
Can the New() method take parameters? Like... New(a:int, b:int)? If yes, how do I use it?

Thanks in advance :)


Perturbatio(Posted 2007) [#2]
No, it can't take parameters, you're better off making a create function instead.

Type myType
	Field a:Int
	Field b:Int
	
	Function Create:myType(a:Int , b:Int)
		Local temp:myType = New myType
			temp.a = a
			temp.b = b
		Return myType
	End Function
End Type


Local instance:myType = myType.create(10, 20)



mothmanbr(Posted 2007) [#3]
Thanks :)