Code: Select all
MsgBox set.a ; Works fine
a := new Set, a.fn() ; Works fine
MsgBox set.read() ; Unknown method????
class Set {
static a := 5
fn() {
MsgBox
}
read() {
return 6
}
}
read()
Code: Select all
MsgBox set.a ; Works fine
a := new Set, a.fn() ; Works fine
MsgBox set.read() ; Unknown method????
class Set {
static a := 5
fn() {
MsgBox
}
read() {
return 6
}
}
SrcStatic methods are defined by preceding the method name with the separate keyword static. These are attached to the class object itself, but are also inherited by subclasses, so this refers to either the class itself or a subclass.
Code: Select all
a := new Set
MsgBox a.prop ; just why?
a.fn() ; just why?
class Set {
static prop := 5
static fn() {
MsgBox
}
}
Code: Select all
a := new Set
a.fn() ; just why?
class Set {
static prop := 5
fn() {
MsgBox this.prop
}
}