```abstract class Base {} class Sub : Base() {} a...
# getting-started
r
Copy code
abstract class Base {}
class Sub : Base() {}

abstract class Foo {
    abstract val x: KClassBase
}
class Bar: Foo {
    override val x: KClassBase = Sub::class
/*
    Type mismatch.
    Required: KClassBase
    Found: KClassSub
 */
}
How to fix?
y
Change it to
KClass<out Base>
r
what does out mean?
also is there a way for me to create an alias to not have to type
KClassout Base
all the time
can I do like
Copy code
type Cls<T> = KClass<out T>
y
Yeah you can do that with
typealias
. The issue here btw is that KClass is invariant, but you want to use it similar to how a list is used, as in that it should "output" things of type
Base
, hence the
out
projected type