TestClass has not got a method 'TestMethod2'.
the prior base does not get called UNLESS the method does not exist in the extended class
Do you mean in the class itself?
If obj has not got the method, obj.base is checked for the method, if not found there obj.base.base is checked ...
Finally if non of the objects has got that Method you will get the error message otherwise the Method would be called.
Code: Select all
class MainClass {
__call(MethodCall){
Msgbox,% MethodCall "`n__call MainClass"
}
MainCall(param){
Msgbox,% "MainCall`nparam: " param
}
}
class TestClass extends MainClass{
__call(MethodCall){
Msgbox,% MethodCall "`n__call TestClass"
}
}
Class TestClass2 extends TestClass{
__call(MethodCall){
Msgbox,% MethodCall "`n__call TestClass2"
}
}
TestClass2:=new TestClass2()
TestClass2.MainCall("test","param")
The method can be also a key where a function would be called dynamically:
Code: Select all
class MainClass {
static MainCall:="MyFunc"
__call(MethodCall){
Msgbox,% MethodCall "`n__call MainClass"
}
}
class TestClass extends MainClass{
__call(MethodCall){
Msgbox,% MethodCall "`n__call TestClass"
}
}
Class TestClass2 extends TestClass{
__call(MethodCall){
Msgbox,% MethodCall "`n__call TestClass2"
}
}
MyFunc(p*){
MsgBox Function %A_ThisFunc% called
}
TestClass2:=new TestClass2()
TestClass2.MainCall("test","param")