I'm trying to implement parametric polymorphism to devolve functions that have case matching statements that use asInstanceOf[]
. I need to match the type of arguments to a classes in another package of the project which accepts parameters. I've tried this code:
def abc[A](x: A, i: Int): Any =
{
x(i)
}
On running, I get an error saying A does not take parameters
. How can I match A
to few of the classes in project1.package1
folder? These classes are similar to an Array/Vector and x(i)
returns i
th element. Each class takes a different datatype (like Int, Double, String etc).