TIL

아이템 43 API의 필수적이지 않는 부분을 확장 함수로 추출하라

open class C
class D: C()

fun C.foo() = "c"
fun D.foo() = "d"

fun main() {
	val d = D()
	print(d.foo()) // d
	
	val c: C = d
	print(c.foo()) // c
}
fun foo('this$receiver': C) = "c"
fun foo('this$receiver': D) = "d"
inline fun CharSequence?.isNullOrBlank(): Boolean { /*...*/ }

public fun Iterable<Int>.sum(): Int { /*...*/ }

정리