What does “trait A <: B” mean?

后端 未结 5 955
情歌与酒
情歌与酒 2020-12-15 06:14

In Scala, what does

trait A <: B

mean? Is it just the same as

trait A extends B

?

Edit

5条回答
  •  醉梦人生
    2020-12-15 07:19

    Looking at the Scala Language Specification, it seems to mean the same thing. The description for trait only mentions the trait A extends B syntax. But the Scala syntax summary uses extends and <: interchangeably for trait definitions:

    TraitTemplateOpt ::= Extends TraitTemplate | [[Extends] TemplateBody]
    Extends ::= ‘extends’ | ‘<:’ 
    

提交回复
热议问题