Get and Set in the same method?

BlitzMax Forums/BlitzMax Beginners Area/Get and Set in the same method?

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.

Please tell me if i missed something with the Null Pointer, why does this set/return 0 :
Type Ship

	Field XVal:Int
	
	Method X:Int( Value:Int = Null )
		 
		If Value = Null Then
			'If you think it wont set it to 0 then just add,
			'Value = 0
			Return Self.XVal
			Else
			Self.XVal = Value
		End If
	
	End Method

End Type

Graphics 800,600, 0

Test:Ship = New Ship

Test.X( 0 )
Print Test.X()

While Not KeyHit( key_escape )
Cls
	
	DrawRect( Test.X(), 50, 100, 100 )

Flip
Wend