我想在AutoHotkey中为员工记录创建自定义类对象。此类对象将存储员工的年龄,姓名和职位。
例如,在Java中:
public class Employee {
public int age;
public String name;
public String title;
public Employee(int age, String name, String title) {
this.age = age;
this.name = name;
this.title = title;
}
}
然后我就可以为新员工设置属性了。
Employee worker1 = new Employee(22, "Timothy", "Programmer");
Employee worker2 = new Employee(26, "Anthony", "Quality Assurance");
我还没能在AHK中找到具有同等功能的任何东西。据我所知,AHK中的对象在功能上是相当基础的。
如何在AutoHotkey中创建具有自定义属性的类对象?
答案 0 :(得分:4)
我不使用AutoHotkey中的类,但它应该是这样的:
Class Employee{
__New(age, name, title)
{
this.age := age
this.name := name
this.title := title
}
}
worker1 := new Employee(22, "Timothy", "Programmer")
worker2 := new Employee(26, "Anthony", "Quality Assurance")