How to simultaneously inherit a class and implement an interface in Kotlin?
Hi everyone! I just started learning Kotlin after Java and encountered a problem that seems very strange to me.
In Java, I could easily write something like:
```java
class MyClass extends BaseClass implements MyInterface {
// ...
}
```
That is, simultaneously inherit a class and implement an interface. But when I tried to do the same in Kotlin, I got a compilation error. Here is my code:
```kotlin
open class BaseClass {
fun baseMethod() {
println("Base method")
}
}
interface MyInterface {
fun interfaceMethod()
}
class MyClass : BaseClass, MyInterface { // Error!
override fun interfaceMethod() {
println("Interface method")
}
}
```
The compiler says: "Only one class may appear in a supertype list". I don't