KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to write some Scala code that needs to do something like: class Test[Type] { def main { SomeFunc classOf[Type] val testVal: Type = new Type() } } and it's failing. I'm obviously not understanding something about Scala generic parameters. Clearly, the misunderstanding is that in C++, templates essentially function like string substitutions, so new Type() will work as long as the class being passed in has a default constructor. However, in Scala, types are different kinds of objects.
Tags (comma-separated)
Save Edits
Cancel