Join Slack
Powered by
You can if you use reflection, but otherwise no. I...
# announcements
k
karelpeeters
09/30/2017, 7:01 PM
You can if you use reflection, but otherwise no. Instead consider adding a parameter for the constructor:
inline fun foo<reified T>(constr: () -> T) { ... }
. You might not even need the
reified
anymore.
e
elect
09/30/2017, 7:02 PM
interesting idea, I'll play with that, thanks
k
karelpeeters
09/30/2017, 7:05 PM
You can obtain a constructor reference with
::
, ie.
foo(::MyClass)
.
2
Views
Open in Slack
Previous
Next