Hi,
When I try the following, I get errors:
open data class Person(val name : String, val age : Int)
data class Employee(name : String, age : Int, val role : String) :
Person(name, age)
fun main(args : Array<String>) {
println(Person(“test”, 99))
println(Employee(“test”, 99, “foo”))
}
output> (3, 1) : Function ‘component1’ generated for the data class conflicts with member of supertype ‘Person’
How should we properly write data class inheritance?
Thanks,
Zemian