1. No protected variables - so programmer can`t encapsulate important values. (May be in the future)
2. User can erase class method using instance variable
Code: Select all
#SingleInstance Force
class Test {
__new(data) {
this.data:= data
}
v1() {
return this.data
}
v2() {
try {
return this.v1()
} catch e {
return e.message
} } }
var:=new Test(100)
msgBOX(var.v1())
var.v1():="" ; <<<< erase v1() method finally
try {
msgBOX(var.v1()) ; call to nonexistent function
} catch e {
msgBOX(e.message)
}
msgBOX(var.v2()) ; call to nonexistent function
And one more example showing changing variable scope in runtime stage:
Code: Select all
#SingleInstance Force
class Timed {
__new() {
this.cn:= 0
}
timed(tm:=0) {
; 1.
if tm, setTimer LABEL, %tm%
else setTimer LABEL, Off
; 2.
LABEL:
tooltip((++this.cn)) ; timer: No object to invoke
; when timer call this code variable scope changed (this not visible)
return
}
}
t:= new Timed()
t.timed(1000) ; method void message 1 and after 1000 ms throw exception No object to invoke
; in normal flow (1. 2.) this is visible
; in timer flow (only 2.) this not visible
Q::ExitApp ; persistent
When timer call the same code - class variables not visible (this not visible).