List of properties

Report a typo

Complete the function that takes a class as input and returns all of its public properties.

This task uses dependencies that may not be available in your local IDE. As a result, you may see compilation errors or unresolved references when running the code locally. This does not affect solution validation when you submit your solution to Hyperskill.

Write a program in Kotlin
import kotlin.reflect.KClass
import kotlin.reflect.full.memberProperties

data class User(val name: String, val age: Int, private val password: String)

fun getProperties(kClass: KClass<*>): Collection<String> {
return // make your code here
}

Create a free account to access the full topic