Kotlin Koan 질문 ( https://github.com/Kotlin/kotlin-koans/blob/master/src/ii_collections/n16FlatMap.kt)에서이 Koan 코드가 있습니다. 어떻게 읽습니까? val
인 변수처럼 보이지만, ()
및 {}
인 함수입니다.val ... get() {...} in Kotlin
val Customer.orderedProducts: Set<Product> get() {
// Return all products this customer has ordered
todoCollectionTask()
}
은 암시 적 게터처럼 보입니다. – njzk2
https://kotlinlang.org/docs/reference/properties.html에 문서화되어 있습니다. –