Hello, any ideas how can i get the class of a gene...
# announcements
a
Hello, any ideas how can i get the class of a generic parameter?
Copy code
abstract class Behavior<T> {
    fun getData(entity: Entity): T {
        return entity.getData(T::class)
    }
}
Got
Cannot use T as reified type parameter
g
I think you have to pass the class of T in the constructor. if im not mistaken you can't yet access the class of a generic type. https://discuss.kotlinlang.org/t/reified-type-parameters-in-classes/1567