Calling a class object by string name
Posted: 09 Mar 2018, 16:21
Hello,
I have a collection of objects stored. I also have a stored a list of obj.__Class strings - so in effect I have a list of the types of object in my collection.
I want to call a method of the class object (what's called the base or prototype object here: https://autohotkey.com/docs/Objects.htm#Custom_Classes), but I don't have an object variable, only a string variable containing the class name. Is that possible?
TIA!
I have a collection of objects stored. I also have a stored a list of obj.__Class strings - so in effect I have a list of the types of object in my collection.
I want to call a method of the class object (what's called the base or prototype object here: https://autohotkey.com/docs/Objects.htm#Custom_Classes), but I don't have an object variable, only a string variable containing the class name. Is that possible?
Code: Select all
class MyClass
{
someMethod()
{
}
}
strClassName := "MyClass"
; How do I call MyClass.someMethod() using strClassName?