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
}
}
本文标题:kotlin 的get() set() 方法
本文链接:https://www.haomeiwen.com/subject/fuhsextx.html
网友评论