delegated properties (1) 썸네일형 리스트형 코틀린[Kotlin]에서 Delegated properties 사용하기 위임된 프로퍼티 (Delegated properties) Kotlin은 특정 객체에 대한 프로퍼티의 set과 get 메서드의 호출을 위임할 수 있는 Delegated properties 메커니즘을 제공합니다. 이 경우 delegate 객체에는 getValue 메서드가 있어야 합니다. 변경 가능한 프로퍼티의 경우 setValue도 필요합니다. import kotlin.reflect.KProperty class Example { var p: String by Delegate() // 1 override fun toString() = "Example Class" } class Delegate() { operator fun getValue(thisRef: Any?, prop: KProperty): String .. 이전 1 다음