Skip to content

Instantly share code, notes, and snippets.

@ryoppy
Created May 1, 2013 05:57
Show Gist options
  • Save ryoppy/5493954 to your computer and use it in GitHub Desktop.
Save ryoppy/5493954 to your computer and use it in GitHub Desktop.
traitで子のプロパティなど参照したいとき
abstract class Interface(_id: Int) {
def id: Int = _id
}
trait Like {
self : Interface =>
def get: Int = this.id
}
trait Param {
self : Interface =>
}
case class A(_id: Int) extends Interface(_id: Int) with Like with Param {
}
println(A(1).id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment