Тема: AHK: Проблема class proretries object array
Вот пример, чтобы видно было, че как. Проблема со свойствами класса, если свойтво обьект.
arr := ["one ", "two ", "three "]
str := "testing..."
t := new Test(arr, str)
msgbox, % "Array property2 will not display`n property1=" t.pS "`n property2=" t.pA[1] t.pA[2] t.pA[3]
msgbox, % "This works`n property1=" t._pS "`n property2=" t._pA[1] t._pA[2] t._pA[3]
t.pS := "none "
MsgBox, % t.pS " " t._pS
t._pS := "something"
MsgBox, % t.pS " " t._pS
Class Test {
pA {
get {
return this._pA
}
set {
this._pA := value
;this.Insert(value)
return value
}
}
pS {
get {
return this._pS
}
set {
this._pS := value . ":)"
return value
}
}
__New(Array, String) {
this.pA := Array
this.pS := String
;MsgBox, % pS
}
}