1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class X { def f(x: AnyRef) = x.toString def f(x: AnyRef, y: AnyRef*) = y.mkString(x.toString) } class Y { def f(x: Int) = x.toString def f(x: Int, y: Int*) = y.mkString(x.toString) } object Test { val x: AnyRef = "a" val res0 = new X res0.f(x) val res1 = new Y res1.f(5) }