Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- import
- Collection
- crawler
- DART
- List
- Flutter
- kotlin
- 다트
- variable
- 클래스
- 함수
- animation
- set
- Class
- 콜렉션
- Android
- 웹크롤러
- 파이썬
- python
- 코틀린
- pushnamed
- function
- 플러터
- Yocto
- map
- 크롤러
- textstyle
- text
- package
- ML
Archives
- Today
- Total
목록위임 (1)
조용한 담장
코틀린(Kotlin) 클래스(Class) : 위임(Delegation)
코틀린(kotlin) 클래스의 위임(delegation) 을 살펴보자. 원문 https://kotlinlang.org/docs/reference/delegation.html 을 보며 정리. Implementation by Delegation kotlin 은 상속의 대안이 되는 Delegation pattern 을 boilerplate code 없이 지원한다. 아래 예제에서, Derived 클래스는 자신의 모든 public 멤버들을 특정 오브젝트(BaseImpl)로 위임하여 Base 인터페이스를 구현할 수 있다. interface Base { fun print() } class BaseImpl(val x: Int) : Base { override fun print() { print(x) } } class ..
kotlin
2020. 1. 2. 16:34