gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 19:15:58 24 4
gpt4 key购买 nike

我想为 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com