I’ve got the following types
class Translator[To <: Language] { ... }
abstract class Language
object English extends Language
object German extends Language
Is there a way to instantiate Translator from a val that is either of type English or German?
I’m looking for something like the following (which doesn’t work):
val lang = if (someCondition) English else German
val translator = new Translator[classOf[lang]]