How can I pass a type as a parameter in scala?
- by rsan
I'm having a really hard time trying to figure out how can I store or pass a type in scala.
What I want to achive is something like this:
abstract class Foo( val theType : type )
object Foo{
case object Foo1 extends Foo(String)
case object Foo2 extends Foo(Long)
}
So at some point I can do this:
theFoo match{
case String =>…