Fix an error

Report a typo

You want to create a function getPlayerInfo() that receives a player and returns information using the getInfo() function. However, the Player class code contains an error. You need to find it, fix the problem, and complete the function.

Write a program in Kotlin
class Player(val id: Int, val name: String) {
companion object {
var role = "playable character"
fun getInfo() = "$id, $name, $role"
}
}

fun getPlayerInfo(player: Player) = // TODO
___

Create a free account to access the full topic