I'm probably overlooking something simple, but here we go anyway. How can I have a method which allows me to both set and get a field ( or several fields ) of a type.
For example :
I thought of using a default null integer for the parameter of the X Method, but since a null integer is equal to zero, that means I can't set the X Position to zero, so no go there.
And before some bright spark says "forget the method, you only need to set or get the field", I know that, this is just a simple example. In the actual code, it won't actually be a field and I need to be able to both get and set with methods. Worse case, I can use two different methods, but it would be nice not to have to.
For example :
Type Ship Field XPos:Int,YPos:Int Method X() ' WHAT HERE? ' WHAT HERE? End Method End Type Local MyShip:Ship=New Ship MyShip.X(4) Print MyShip.X()
I thought of using a default null integer for the parameter of the X Method, but since a null integer is equal to zero, that means I can't set the X Position to zero, so no go there.
And before some bright spark says "forget the method, you only need to set or get the field", I know that, this is just a simple example. In the actual code, it won't actually be a field and I need to be able to both get and set with methods. Worse case, I can use two different methods, but it would be nice not to have to.