(MPP newbie here, so if there's a resource I'm mis...
# multiplatform
r
(MPP newbie here, so if there's a resource I'm missing that answers my questions, please let me know) Is there no way to have a default method implementation in an expect class?
Copy code
expect class Grade : Comparable<Grade> {
    val rough: Int
    val fine: Int

    // Apparently I can't implement this here
    override fun compareTo(other: Grade) {
        var result = rough.compareTo(other.rough)
        if (result == 0) result = fine.compareTo(other.fine)
        return result
    }
}
r
You can do
expect class Grade : GradeInterface
where
GradeInterface
has your default implementations
And specifically for
compareTo
. you could do and extension function
operater fun Grade.compareTo()
r
Hmm, interesting. Thanks for the info.
r
There's also https://youtrack.jetbrains.com/issue/KT-20427 around this functionality