クソだとはわかってる。でも速度が大事だから。ファーストペンギン。
case class Friends(message: String = "") {
def wai() = {
new Friends(this + "わーい")
}
def sugoi() = {
new Friends(this + "すごーい")
}
def tanoshii() = {
new Friends(this + "たのしー")
}
def friends(skill: String) = {
new Friends(this + s"君は${skill}がとくいな、フレンズなんだね!!")
}
override def toString: String = message + "\n"
}
println(Friends() wai() sugoi() tanoshii() friends("scala"))
元ネタ
兄弟たち
Golang: http://qiita.com/sakajunquality/items/5c4a2dc6967e584193ad
Ruby: http://qiita.com/844196/items/debc0cd1d39a6c3e32c7
Python: http://qiita.com/Nao-Y/items/f544a96cbd09b135c7e7
Java: http://qiita.com/hanakayui0628/items/97242465693bda8cacd2
ジャパリパーク: http://qiita.com/enzirion/items/cd97ee3667756b18f006
Swift: http://qiita.com/fromkk/items/0797bdf3923622073a4f
C++: http://qiita.com/ur_kinsk/items/533d3780eb4f87fa6770
Lua: http://qiita.com/ken_ton/items/f8aeed7779476ece6198
C#: http://qiita.com/Temarin/items/7bcdb9f42b0d209a53cc
Pony: http://qiita.com/kubo39/items/318090ea206288fc1f08