小编mor*_*ina的帖子

Scala REPL"错误:值>不是类型参数T的成员"

这是我的档案

trait Set[T] {
    def contains(x: T): Boolean
    def incl(x: T): Set[T]
    def union(that: Set[T]): Set[T]
}

class Empty[T] extends Set[T] {
    override def toString = "."
    def contains(x: T): Boolean = false
    def incl(x: T): Set[T] = new NonEmpty[T](x, new Empty[T], new Empty[T])
    def union(that: Set[T]): Set[T] = that
}

class NonEmpty[T](elem: T, left: Set[T], right: Set[T]) extends Set[T] {
    override def toString = "{" + left + elem + right + "}"

    def contains(x: T): Boolean =
        if …
Run Code Online (Sandbox Code Playgroud)

scala compiler-errors class

4
推荐指数
1
解决办法
4097
查看次数

标签 统计

class ×1

compiler-errors ×1

scala ×1