class - 如何在 AutoHotkey 中创建一个类?

标签 class autohotkey

我想为 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 中创建具有自定义属性的类对象?

最佳答案

我不使用 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")

关于class - 如何在 AutoHotkey 中创建一个类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45869823/

相关文章:

连接IBM PCOMM的JAVA程序

autohotkey - 是否有 AutoHotkey REPL?

autohotkey - 使用 AutoHotKey 右键单击​​ Windows 10 中的托盘图标

c++ - 类对象为 float 类型

c++ - 这是 C++ 链表的深层复制和正确实现的 = 运算符吗?

c++ - 类名未声明类型 C++

autohotkey - 如何在 Autohotkey 中重新映射 CTRL-x CTRL-c?

class - Laravel 4使用供应商类

c++ - 如何在类中使用 vector

autohotkey - 当文件开始存在时如何使用自动热键对其进行操作?