The commented-out version of class Foo runs and behaves as I would like the first version of Foo to run. I am trying to get this behavior without using class variables in the first version, but run into compilation or logical errors.
Using this.bar in line 10 doesn't compile. Using Foo.bar compiles, but I think it changes the behavior of this in bar() at line 18, making this.qux reference the empty class variable Foo.qux instead instead of the instance variable foobar.qux
Code: Select all
#SingleInstance Force
#Persistent
foobar := new Foo
class Foo {
qux := "default"
__New() {
this.qux := "Thud"
Menu, Tray, Add, Thud, this.bar
Menu, Tray, Add
Menu, Tray, NoStandard
Menu, Tray, Standard
return this
}
bar() {
MsgBox % this.qux
}
}
;class Foo {
; static qux := "default"
;
; __New() {
; Foo.qux := "Thud"
; Menu, Tray, Add, Thud, Foo.bar
; Menu, Tray, Add
; Menu, Tray, NoStandard
; Menu, Tray, Standard
; return this
; }
;
; bar() {
; MsgBox % Foo.qux
; }
;}