Skip to content

Instantly share code, notes, and snippets.

@shizone
Created December 8, 2011 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shizone/1445950 to your computer and use it in GitHub Desktop.
Save shizone/1445950 to your computer and use it in GitHub Desktop.
ボス
class Boss {
protected var age_ : Int = _
def age = age_
def age_=(value: Int): Unit = this.age_ = value
}
val tama: Boss = new Boss {
override def age = if (20 < this.age_) 20 else this.age_
}
tama.age = 0x20
println(tama.age)
@shizone
Copy link
Author

shizone commented Dec 8, 2011

出先なのでLoad of the REPLsで動作確認した。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment