I\'m looking to pass a Class as a parameter to a Scala function like so:
def sampleFunc (c : Class) : List[Any]
(Side question: should the ty
In Scala, if you need to deal with classes, there is probably a different way to approach the problem.
So I'm not claiming to resolve the title of the question, but the specific need that you post. To check if a specific object is of a specific type, the typical approach in Scala is the use of pattern matching. Unless I'm missing something, this should work
def checkType(obj: Any) = obj match {
case y: Int => "get int"
case _ => "Other"
}
See http://docs.scala-lang.org/tutorials/tour/pattern-matching.html