Hi I'm trying to instantiate an `inner class` refl...
# announcements
s
Hi I'm trying to instantiate an
inner class
reflectively using Kotlin-reflection library it's not hard except that I need to pass an instance of the parent class to the child class constructor. Is there any function/way to get the
KType
of parent class (without using it's name and
Class.forName()
)? here is an example of what I'm trying to achieve:
Copy code
class Parent {

    inner class Child()
}

fun main() {
    val childType: KType = typeOf<Parent.Child>()

    val parentType = childType.getParent()
}