我想为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;
}
}
Run Code Online (Sandbox Code Playgroud)
这样便可以为新员工设置属性。
Employee worker1 = new Employee(22, "Timothy", "Programmer");
Employee worker2 = new Employee(26, "Anthony", "Quality Assurance");
Run Code Online (Sandbox Code Playgroud)
我无法在AHK中找到具有等效功能的任何东西。据我所知,AHK中的对象在功能上是相当基本的。
如何在AutoHotkey中创建具有自定义属性的类对象?
我不在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")
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
956 次 |
最近记录: |