Foggy day
Kotlin - constructor 본문
1.
class Person constructor(name: String) {
val name: String
init {
this.name = name
}
}
2.
class Person constructor(name: String) {
val name: String = name
}
3.
class Person constructor(val name: String) {
}
4.
class Person(val name: String) {
}
'Kotlin' 카테고리의 다른 글
Kotlin - companion object (0) | 2021.03.16 |
---|---|
Kotlin - destructing (0) | 2021.03.16 |
Kotlin - data class (0) | 2021.03.15 |
Kotlin - class extension (0) | 2021.03.15 |
Kotlin - variable initialization (0) | 2021.03.15 |