tcpoly_overriding.scala
来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 16 行
SCALA
16 行
abstract class A[t[x]] { def b: t[Int]}class B extends A[List] { // underlying functionality being tested is overriding, but bugs manifest itself during erasure // erasure should generate two methods: one that returns an Object (to implement the method in A) // one that is as close as possible to the original method and thus returns a List // the problem only manifests itself here -- but it's really a problem with overriding // the link between this method and the method in A isn't seen def b: List[Int] = List(1)}object Test extends Application { Console.println((new B).b(0))}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?