Like `interface MyInterface: T where T : SomeType`...
# announcements
j
Like
interface MyInterface: T where T : SomeType
?
p
You can specify this at usage point only:
Copy code
fun <T> foo(o: T) where T : MyClass, T : MyInterface {
    // ...
}
So it is still possible to declare class that implements interface
MyInterface
and does not extend
MyClass
, but at least you will not be able to pass such instance to this function.
j
Ok thanks - that might be useful. I’m fighting against frameworks that want me to subclass everything, instead of providing interfaced components that I can re-use. Trying to decouple my implementations.
s
I was just about to mention composition over inheritance until I saw the last message 😂
👍 1