``` abstract class KnowsChildrenTypes() { comp...
# reflect
k
Copy code
abstract class KnowsChildrenTypes() {
    companion object {
        val types = mutableSetOf<Class<out KnowsChildrenTypes>>()
    }
    
    init {
        types += this::class.java
    }
}

class Child1 : KnowsChildrenTypes()
class Child2 : KnowsChildrenTypes()
s
@levans002 oops linked to wrong item. did you try something like this?
k
no, just came up with it
s
@kirillrakhman sorry, i was tagging my coworker so he would see this solution. Apparently this won't work for him because he needs to know what classes he can init before they are ever instantiated.
k
then you'll need a classpath scan