A Factoid: The Enforcing-Inheritance-Generic-Thing-in-Kotlin
I learn a Kotlin thing everyday. Today’s thing, “Enforcing-Inheritance-Generic-Thing-in-Kotlin” (I’m terrible with names and terms, there’s an official term for this that I cannot remember). I have a function that starts an activity for a result. I want to limit this function to only be able to start activities extending an abstract class, FooActivity. In Java:
private void start(Activity activity, Class<? extends FooActivity> cls) { // some stuff with intents } In Kotlin: