kotlin - Kotlin 中学班建设者
问题描述
我有一些导致错误的代码。我似乎找不到问题,因为我一直在关注一本书。代码如下:
class Player (_name: String,
var healthPoints: Int,
val isBlessed: Boolean,
private val isImmortal: Boolean) {
var name = _name
get() = field.capitalize()
private set(value) {
field = value.trim()
}
constructor(name: String) : this(name,
healthPoints = 100,
isBlesed = true,
isImmortal = false)
我不明白这个关键字正在创建的错误如下:
Error:(14, 33) Kotlin: None of the following functions can be called with the arguments supplied:
public constructor Player(name: String) defined in com.bignerdranch.nyethack.Player
public constructor Player(_name: String, healthPoints: Int, isBlessed: Boolean, isImmortal: Boolean) defined in com.bignerdranch.nyethack.Player
解决方案
你这个词有错别字isBlesed
。
推荐阅读
- java - DynamoDB 中的批量更新
- std - SSCANF 怎么会提供如此奇怪的结果?
- c++ - 我可以在函数参数中推断出元组元素类型(即使用 std::tuple_element)吗?
- oracle11g - 需要在 Oracle 上按日期计算每小时记录和分组
- c# - ASP.NET Core API 版本控制 - 部分取代以前的方法版本
- java - 道房数据库无法访问
- python - 调试为什么 Dask Dataframe 操作什么都不做
- c# - 格式化字符串(掩码?)
- java - Java中的Euler项目#3;程序不输出结果
- ansible - Ansible 变量值作为变量名