类型 raygun(currentCharge 为 int,maxDamage 为 int,minDamage 为 int)
我找不到任何示例来演示如何在初始化时将类型的属性设置为默认值。例如,在这种情况下,将 currentCharge 默认为 100 是有意义的。我知道目前不支持常量,但我想知道是否有一种我可能没有考虑过的方法来做到这一点。
类型 raygun(currentCharge 为 int,maxDamage 为 int,minDamage 为 int)
我找不到任何示例来演示如何在初始化时将类型的属性设置为默认值。例如,在这种情况下,将 currentCharge 默认为 100 是有意义的。我知道目前不支持常量,但我想知道是否有一种我可能没有考虑过的方法来做到这一点。