Method New

BlitzMax Forums/BlitzMax Beginners Area/Method New

Can the New() method take parameters? Like... New(a:int, b:int)? If yes, how do I use it?

Thanks in advance :)

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)


Thanks :)