jeudi 15 juillet 2021

Documentation sources for Scala cross referencing in traits

Sometime ago I saw such example of defining traits that allow the extender to choose what implementation is easier and override one of the methods:

trait Foo {
  def a: String = b
  def b: String = a
}

final class Bar extends Foo {
  override def a: String = "a"
}

I can't find that doc now, so asking if anybody have it at hand.

Aucun commentaire:

Enregistrer un commentaire