Explain: Let Object have property that contain reference to functions
- Get - return value
- Set - set value
- Call - return result from calling reference
Code: Select all
class proto { ;test class =====================================================
__Call(name, para) { ;call callable property ------------------------------
try return this.%name%.call(this, para*)
catch
throw { message: '<' this.__Class '> has no method or callable property <' name '>' }
} ;------------------------------------------------------------------------
me_0(a) => A_ThisFunc ': ' a
pr_0[a:=''] {
get => A_ThisFunc ': ' a ;callable prop [parameters]
set => '' ;callable prop (no returun result)
}
pr_1:= (this, a) => A_ThisFunc ': ' a ;callable prop (ref)
} ;============================================================================
b:= proto.new() ;tests -------------
MsgBox(b.me_0(123)) ;123 (ok)
try b.pr_0 ;proto.__Call (ok)
catch e
MsgBox(e.message)
;:= <identificator> ;get
;<identificator> := ;set
;<identificator> ;call
MsgBox(b.pr_0[234]) ;.get (ok)
MsgBox(b.pr_0:=345) ;.set (ok)
MsgBox(b.pr_1(456)) ;.call (ok) <<< suggest