Ignoring predefined ancestors as permitted, the Scala trait linearizations areA
super call in a trait continues to the next applicable implementation in the receiver's Scala trait linearization. It is not permanently bound to the parent named when that trait was declared.For The shared ancestor
d1.h, enter B2.h. Its super.g reaches B1.g, and that method's super.f reaches A.f. For d2.h, enter B1.h; its super.g reaches B2.g, whose super.f again reaches A.f. Therefore the two output lines areh in B2, g in B1, f in A
h in B1, g in B2, f in AA occurs once in each Scala trait linearization, after the two specialized traits. This accounts for the final f in A in both lines. Articles by others on the same topic
There are currently no matching articles.