Why Dont you only create an instance of the class/object, AFTER you have the details. Then when you create it you add the details, and then can be sure that you never have a null instance
(To be honest a Null Instance sounds stupid anyway ;)
The main difference to what you are doing is that the values are passed to member function of the type/class, rather than to a member method. Normaly
Type Type1
field Field1:int
Function Create:Type1(Val:int)
temp:Type1 = new Type1
temp.Field1 = Val
return Temp
endfunction
endtype
Global Instance:Type1 = Type1.Create(Val:int)
Because the function is not attatched to a specific instance of the type, (Its part of the type itself), wether Field1 is NUll or not is arbitary, because the INSTANCE doesnt exist until after you have given it the values.
I assume you have somthing like
Type Type1
Field Field1:int
Meethod SetField1(Val:int)
Field1 = Val
endMethod
endtype
Global Instance:Type1 = New Type1
..
..
Instance.Setfield1(Val:int)
In this case the method to set the fields belongs to the instance of the type, not the Type itself. This Means that the instance exists with either No values or arbitary values, hence the problem
Por supesto I might be wrong
(To be honest a Null Instance sounds stupid anyway ;)
The main difference to what you are doing is that the values are passed to member function of the type/class, rather than to a member method. Normaly
Type Type1
field Field1:int
Function Create:Type1(Val:int)
temp:Type1 = new Type1
temp.Field1 = Val
return Temp
endfunction
endtype
Global Instance:Type1 = Type1.Create(Val:int)
Because the function is not attatched to a specific instance of the type, (Its part of the type itself), wether Field1 is NUll or not is arbitary, because the INSTANCE doesnt exist until after you have given it the values.
I assume you have somthing like
Type Type1
Field Field1:int
Meethod SetField1(Val:int)
Field1 = Val
endMethod
endtype
Global Instance:Type1 = New Type1
..
..
Instance.Setfield1(Val:int)
In this case the method to set the fields belongs to the instance of the type, not the Type itself. This Means that the instance exists with either No values or arbitary values, hence the problem
Por supesto I might be wrong