Last active
December 17, 2015 03:59
-
-
Save aoiroaoino/5547484 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 Human(name: string) { | |
def say(partner: String): String = { | |
return "Hello " + partner | |
} | |
} | |
// | |
// 値を持たせるだけならもっと簡潔に書ける | |
// | |
class Cat(val name: String) | |
case class Dog(name: String) | |
// | |
// 最後に評価された値が返り値となる | |
// | |
def say(partner: String) = "Hello " + partner | |
def myName = name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment