New is a built in blitzmax command that instantiates a New instance of an object.
New cannot accept any parameters, which means all your auto-initialization stuff has to be handled in the New method for the type.
Create is (generally) a custom made function.
*EDIT*
Spent too long writing this reply :)
New cannot accept any parameters, which means all your auto-initialization stuff has to be handled in the New method for the type.
Create is (generally) a custom made function.
SuperStrict Type TNewType Field X:Int Field Y:Int Field Name:String Global TypeList:TList Method New() If TypeList = Null Then TypeList = New TList X = 10 Y = 20 Name = "New TTest Type" Self.TypeList.addLast(Self) End Method End Type Local a:TNewType = New TNewType a.X = 20 a.Y = Rand(101) a.Name = "a" Local b:TNewType = New TNewType Local c:TNewType = New TNewType Local d:TNewType = New TNewType For Local tn:TnewType = EachIn TNewType.TypeList Print tn.Name + ": "+ tn.X + ", " + tn.Y Next '''''''''''''''''''''''''''''''''''''''''''''''''''''''' Type TCreateType Field X:Int Field Y:Int Field Name:String Global TypeList:TList Function Create:TCreateType(X:Int = 10 , Y:Int = 20 , Name:String = "New TCreateType") If TypeList = Null Then TypeList = New TList Local temp:TCreateType = New TCreateType temp.X = X temp.Y = Y temp.Name = Name TypeList.addLast(temp) Return temp'return the type created in case the user wants to assign it to a variable End Function End Type Local x:TCreateType = TCreateType.Create(10 , 30 , "x") Local y:TCreateType = TCreateType.Create() Local z:TCreateType = TCreateType.Create(100 , 20) Local w:TCreateType = TCreateType.Create(10 , 2 , "W") For Local tc:TCreateType = EachIn TCreateType.TypeList Print tc.Name + ": "+ tc.X + ", " + tc.Y Next
*EDIT*
Spent too long writing this reply :)