FrMan
FrMan

Reputation: 31

Kotlin multiple inheritance between interfaces

i want to know if there'a way to declare that an interface extends another interface with three different generics type parameters

interface AggDBTree: DBTreeInterface<T, X, V>{
 //method declarations
}

Upvotes: 1

Views: 400

Answers (1)

zsmb13
zsmb13

Reputation: 89548

If you want that superinterface to have three different generic parameters, you can do that:

interface DBTreeInterface<A, B, C>

interface AggDBTree<T, X, V> : DBTreeInterface<T, X, V>

If you want to implement the same interface, but with various type parameters, that is not possible. So something like this will not compile:

interface DBTreeInterface<T>

interface AggDBTree<A, B> : DBTreeInterface<A>, DBTreeInterface<B>

You can only extend a single interface once.

Upvotes: 2

Related Questions