Method and field with same name
BlitzMax Forums/BlitzMax Programming/Method and field with same name
| ||
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 |
| ||
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 ) . |
| ||
I'd either a) change it to _position:tPosition3 or b) change it to fPosition:tPosition3. |
| ||
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? |
| ||
/* clr */ |
| ||
I think I like entity.setposition x,y,z |