Method and field with same name

BlitzMax Forums/BlitzMax Programming/Method and field with same name

JoshK(Posted 2006) [#1]
What would you suggest I do here?

Type tPosition3
	Field x#,y#,z#
EndType

Type tEntity
	Field Position:tPosition3
	Method Position(x#,y#,z#)
		Position.x=x
		Position.y=y
		Position.z=z
	EndMethod
EndType



Helios(Posted 2006) [#2]
Why not just change the position method to SetPosition? Or do what some of the brl modules do which is put a under-score before fields eg( Field _Position:tPosition3 )
.


N(Posted 2006) [#3]
I'd either a) change it to _position:tPosition3 or b) change it to fPosition:tPosition3.


Jake L.(Posted 2006) [#4]
Lacking some class-features like privates, properties and such I now use a naming style in large projects to maintain overview:

Type TTexture
Field Blendmode%
Field rWidth%
Field rHeight%
Field _FileWidth%
Field _FileHeight%

Method _DoSomePrivateStuff()
End Method
End Type

Fields r... are readonly Properties, if I want to change it I have to use a method for it.

Fields and Functions _... are strictly private, I never touch them from outside this type.

"Normal" Variables are to be changed directly (cause they are too simple to write an extra Setxxx-Method for it).

Maybe you want to stick to something like this?


morszeck(Posted 2006) [#5]
/* clr */


JoshK(Posted 2006) [#6]
I think I like entity.setposition x,y,z