``` fun <T:Any> get(c: KClass<T>) : T...
# announcements
j
Copy code
fun  <T:Any> get(c: KClass<T>) : T{
         return c.createInstance()
     }
c
This will only work for classes with default no-arg constructor or with a constructor all params of which are optional. See
createInstance
doc
j
yup that’s ok it should only be called for pojo type classes
l
inline fun <reified T: Any> create() = T::class.java.newInstance()
?