Avatar ·

How to declare a generic class in Kotlin that simultaneously extends a class and implements an interface?

Hi everyone! I started learning Kotlin after Java and encountered a confusing situation. In Java, I could easily write a generic class that simultaneously extends some base class and implements an interface: ```java public class MyClass { // ... } ``` But when I tried to do the same in Kotlin, it didn't work. Here's my code: ```kotlin open class BaseClass interface MyInterface // Attempt 1: doesn't compile class MyClass where T : BaseClass, T : MyInterface // Attempt 2: also doesn't work class MyClass // Error! ``` I tried different variations, but the compiler keeps giving errors. I need type T to simultaneously be a subclass of BaseClass and implement MyInterface. Wha