is there any way to define an initialized type as a default parameter or constant value? for example:
i want to either be able to pass in an intialized t1 to test() or just let it use a set default. since t1.create() was a static type function i thought for sure this would work :( now i could handle this inside of test with:
simple enough, but when i extend the class the "If" statement must be included in each subtyped override of test() since calling Super.test(v) wont return the initialized variable if v started off as Null. not very OOP friendly :( anyone else have some thoughts around this or have accomplished something along these lines? i have also tried Type globals and Type constants but all give the same "must be constant" compile error.
thx.
Framework BRL.Blitz Type t1 Field val1:Int Field val2:Int Field val3:Int Function create:t1() Local retval:t1=New t1 retval.val1=5 retval.val2=10 retval.val3=15 Return retval EndFunction EndType Type t2 Method test(v:t1=t1.create()) DebugLog(v.val1) DebugLog(v.val2) DebugLog(v.val3) EndMethod EndType
i want to either be able to pass in an intialized t1 to test() or just let it use a set default. since t1.create() was a static type function i thought for sure this would work :( now i could handle this inside of test with:
Method test(v:t1=Null) If Not v Then v=t1.create() DebugLog(v.val1) DebugLog(v.val2) DebugLog(v.val3) EndMethod
simple enough, but when i extend the class the "If" statement must be included in each subtyped override of test() since calling Super.test(v) wont return the initialized variable if v started off as Null. not very OOP friendly :( anyone else have some thoughts around this or have accomplished something along these lines? i have also tried Type globals and Type constants but all give the same "must be constant" compile error.
thx.