samedi 2 mai 2020

How to avoid overload conflicts in Kotlin?

Suppose I have these interfaces

interface BaseDatabase

interface UpdatingDB {
    fun getSessionStat(): UpdaterSessionStat
}

interface InsertingDB {
    fun getSessionStat(): InserterSessionStat
}

And I want a class to implement all of them

class MyDB: BaseDatabase, UpdatingDB, InsertingDB {
    override fun getSessionStat(): UpdaterSessionStat {
        TODO("Not yet implemented")
    }

    override fun getSessionStat(): InserterSessionStat {
        TODO("Not yet implemented")
    }
}

But it results in overloading error. What are probable fixes\workarounds here to be able to have one class implemented all those interfaces ? With except for modifying interfaces itself.

Aucun commentaire:

Enregistrer un commentaire