KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to make a type-alias (or something equivalent) in Scala that takes two parameters and returns their common supertype? In other words, I'm trying to find something with this signature: type CommonSupertype[A, B] // can't be more specific where these hold true: (pseudocode) CommonSupertype[String, Int] = Any CommonSupertype[JButton, JPanel] = JComponent etc. I haven't been able to find it myself, but I can't use alternatives like adding an extra parameter, since I have to follow a pre-specified interface.
Tags (comma-separated)
Save Edits
Cancel