In javascript there is a method called call. In that method you pass the "object" you want to operate on. This is really useful when you want to override a class method just partially, or you want to use it at some point of the child class.
For example:
Code: Select all
class parent {
__New(bar){
this.foo:=bar
}
hello(){
return this.foo
}
}
class child extends parent{
hello(){
msgbox, % base.hello()
}
}
Code: Select all
test := new child("Hi")
test.hello()
In the documentation says that the this object is added as first parameter, so when i access base method it should get the child object in his this reference. What am I missing? What I did wrong?
Thanks in advance.
Docu
•base.Method() always invokes the base of the class where the current method was defined, even if this is derived from a sub-class of that class or some other class entirely.
•base.Method() implicitly passes this as the first (hidden) parameter.