bcc
bcc copied to clipboard
Structs: Return VarPtr Self - not possible
SuperStrict
Framework Brl.StandardIO
Struct STest
Field X:Int
Method Add:STest Ptr(value:Int)
X :+ value
Return Varptr Self
End Method
End Struct
lets bcc spit out: Compile Error: Subexpression for 'Varptr' must be a variable or an element of an array, pointer or string
.
So how to return a "reference" (pointer) of a struct?
"idea" is to enable structs to daisy chain methods:
myStruct.Add(x).Subtract(y).Multiply(z) 'altering the original myStruct with each Method call