blob: c9b6d6f39f8dfa45804345bc86a8a600aaa0bf11 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
trait A[@specialized(Int) K, @specialized(Double) V] {
def doStuff(k: K, v: V): Unit = sys.error("I am overridden, you cannot call me")
}
trait B[@specialized(Double) V] extends A[Int, V] {
override def doStuff(k: Int, v: V): Unit = println("Hi - I'm calling doStuff in B")
}
object Test {
def main(args: Array[String]): Unit = delegate(new B[Double]() {}, 1, 0.1)
def delegate[@specialized(Int) K, @specialized(Double) V](a: A[K, V], k: K, v: V) {
a.doStuff(k, v)
}
}
|