default param values!
BlitzMax Forums/BlitzMax Programming/default param values!
| ||
IGNORE THIS - IM TALKING PoO Method Set_Transform(x:Float,y:Float,r:Float=0,sx:Float=1,sy:Float=1) the above method definition is fine - but it would seem that despite having set the param type as float, if the default assignment is int..the param type becomes int..so passing floats using the above definition will result in cast to int... ..i spent ages trying to figure out what the hell was going in here...BE WARNED :p ;) Method Set_Transform(x:Float,y:Float,r:Float=0.0,sx:Float=1.0,sy:Float=1.0) this version works fine.. |
| ||
Works fine.Function Blah:Float( a:Float = 1 ) Print a End Function Type f Method Blah:Float( a:Float = 1 ) Print a End Method End Type New f.Blah( Pi ) Blah( Pi ) Input |
| ||
lol - ok im totally wrong...but i made that change in my own code + it worked - very odd..maybe ive inhaled too many paint fumes :p thanks for correcting me noel ;) |