kotlin 的get() set() 方法
2017-09-26 本文已影响146人
吃货养成记
1 class KotlinEntity{
var name: String? =""
set(value) {name=field}
get() {
return field
}
}
2 class KotlinEntity{
var name: String
set(value) {name=value}
get() {
return name
}
}
1 class KotlinEntity{
var name: String? =""
set(value) {name=field}
get() {
return field
}
}
2 class KotlinEntity{
var name: String
set(value) {name=value}
get() {
return name
}
}