Scala passing type parameters to object

后端 未结 4 1900
北恋
北恋 2021-02-20 09:11

In Scala v 2.7.7

I have a file with

class Something[T] extends Other

object Something extends OtherConstructor[Something]

This throws

4条回答
  •  既然无缘
    2021-02-20 09:39

    An object has to have a concrete type. The Scala object contruct is not a exception to this rule.

    A valid definition is

    object Something extends OtherConstructor[Something[T]] { }
    

    where T is some concrete type.

提交回复
热议问题