rahulsom
05/19/2017, 2:24 AMpublic interface AggregateType<AggregateIdT> {
AggregateIdT getId();
}
I wrote this in my kotlin class
data class Patient(val id: String, val identifier: String): AggregateType<String>
I'm assuming that kotlin would provide me a getId()
method. However, I get this error:
Class 'Patient' must be declared abstract or implement abstract member public abstract fun getId(): String!
When I do try to implement it like this:
data class Patient(val id: String, val identifier: String): AggregateType<String> {
override fun getId() = id
}
I get a Platform Declaration clash.blakelee
05/19/2017, 5:35 AMclass Patient(val id: String, val identifier: String) {
fun getId() = id //This is of type string
//no set because it's immutable
fun getIdentifier() = identifier
}
adding the interface would make it look like this I believe
class Patient(val id: String, val identifier: String) : AggregateType<String> {
fun getId() = id //This is of type string
override fun getId() = id //Now there are two functions named getId with the same signature
//no set because it's immutable
fun getIdentifier() = identifier
}