Skip to content

Instantly share code, notes, and snippets.

@kwmt
Created October 15, 2019 05:32
Show Gist options
  • Save kwmt/7bb89d5e7228dff3974e212ac80b4394 to your computer and use it in GitHub Desktop.
Save kwmt/7bb89d5e7228dff3974e212ac80b4394 to your computer and use it in GitHub Desktop.
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