kotlin - Kotlin - 超级主要构造函数?
问题描述
IntelliJ IDEA 抱怨构造函数。
转换为主构造函数
在这个例子中,人们将如何做到这一点?
class Turtle : ActorBeta {
constructor() : super()
override fun act(dt: Float) {
super.act(dt)
if(Gdx.input.isKeyPressed(Input.Keys.LEFT))
this.moveBy(-1f, 0f)
if(Gdx.input.isKeyPressed(Input.Keys.RIGHT))
this.moveBy(1f, 0f)
if(Gdx.input.isKeyPressed(Input.Keys.UP))
this.moveBy(0f, 1f)
if(Gdx.input.isKeyPressed(Input.Keys.DOWN))
this.moveBy(0f, -1f)
}
}
解决方案
推荐阅读
- python - 试图抓取网页。下载的 html 代码与现场代码略有不同
- google-cloud-platform - 如何更改默认的 Google Cloud 用户名?
- javascript - 在 webView 中从 JavaScript 调用 Android 共享意图
- python-3.5 - Hashicorp vault hvac 客户端不读取秘密,总是打印“无”
- python - 我应该如何找到对应于抛物线的最大或最小 y_value 的 x_value?(在 Python 中)
- web-scraping - 如何使用 selenium 和 python 从下拉菜单中的所有情况下更快地从 Web 表单中抓取数据
- typo3 - 如何在 TYPO3 10x 中使用 .less 文件
- .htaccess - 使用 .htaccess 将路径字符串作为 GET 变量重定向到主页
- svg - 如何将 SVG 路径向右移动?
- git - 如何搜索丢失提交的代码?