Created
December 8, 2011 03:11
-
-
Save shizone/1445950 to your computer and use it in GitHub Desktop.
ボス
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
出先なのでLoad of the REPLsで動作確認した。