class List { def isEmpty ( ): Int = this.isEmpty ( ); def head ( ): Int = this.head ( ); def tail ( ): List = this.tail ( ); def cons (x : Int ): List = this.cons (x ); // .. } class Cons extends List { val head : Int; val tail : List; def isEmpty ( ): Int = false; def head ( ): Int = this.head; def tail ( ): List = this.tail; def cons (x : Int ): List = new Cons (x, this ); }