Created
October 15, 2019 05:32
-
-
Save kwmt/7bb89d5e7228dff3974e212ac80b4394 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
data class Person(val age:Int, val name:String) { | |
val greet | |
get() = "年齢は${age}です" | |
fun testPrint() { | |
println("testPrint ${age}" ) | |
} | |
} | |
fun main() { | |
val p = Person(3, "a") | |
println(p.greet) | |
// Output | |
// 年齢は3です | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment