Is there any way to extend an object?

前端 未结 6 849
礼貌的吻别
礼貌的吻别 2020-12-05 06:29

In scala, we cannot extend object:

object X 
object Y extends X

gives an error error: not found: type X

I

6条回答
  •  借酒劲吻你
    2020-12-05 06:39

    The only way to share code between two objects is by having one or more common superclass/trait.

提交回复
热议问题