what would be the good way to implement interface ...
# getting-started
k
what would be the good way to implement interface that have method getName(), abstract class that implement that method, and normal class that extend abstract, and actually have specific name? Name is just string field.
d
In Kotlin it would be more idiomatic to make a
name
property instead of a
getName
method. Then you'd have something like this:
Copy code
interface I {
    val name: String
} 

abstract class A : I {
    override val name: String get() = "hello"
}

class B(override val name: String) : A()
1