Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How to do delegation in Kotlin
Search
Harri Kirik
February 05, 2018
Programming
0
37
How to do delegation in Kotlin
5 minute talk about delegation in Kotlin programming language.
Harri Kirik
February 05, 2018
Tweet
Share
More Decks by Harri Kirik
See All by Harri Kirik
Secure programming techniques: Mobile Development Security guest lecture
harri35
0
81
Support for HSM-like capabilities in Android
harri35
0
130
Why doesn't my in-app QR code work (on location)?
harri35
0
32
Git merge-base
harri35
1
72
Smoke testing your library
harri35
0
27
Collections in Kotlin
harri35
0
35
Data classes in Kotlin
harri35
0
34
Two-factor authentication at GDG Riga
harri35
0
74
Two-factor authentication at GDG Tartu
harri35
0
56
Other Decks in Programming
See All in Programming
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
160
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
6
300
AIコーディングエージェント(NotebookLM)
kondai24
0
160
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
690
Developing static sites with Ruby
okuramasafumi
0
230
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
370
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
手が足りない!兼業データエンジニアに必要だったアーキテクチャと立ち回り
zinkosuke
0
580
エディターってAIで操作できるんだぜ
kis9a
0
690
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
250
connect-python: convenient protobuf RPC for Python
anuraaga
0
370
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.9k
Producing Creativity
orderedlist
PRO
348
40k
Building Adaptive Systems
keathley
44
2.9k
Mobile First: as difficult as doing things right
swwweet
225
10k
Code Reviewing Like a Champion
maltzj
527
40k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
Thoughts on Productivity
jonyablonski
73
5k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Designing for Performance
lara
610
69k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.3k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
GitHub's CSS Performance
jonrohan
1032
470k
Transcript
designing & developing for mobile Demoday, 05/02/2018 Harri Kirik, engineer
Kotlin: Delegation
Kotlin KOTLIN: DELEGATION #kotlin
Delegation pattern KOTLIN: DELEGATION #delegation
Java example KOTLIN: DELEGATION #java
KOTLIN: DELEGATION class CarBody { int getDoorCount() { return 4;
} } class Car { CarBody body; public Car(CarBody body) { this.body = body; } public int getDoorCount() { return body.getDoorCount(); } } #demoday
Kotlin example KOTLIN: DELEGATION #kotlin
The by-clause KOTLIN: DELEGATION #by-clause
KOTLIN: DELEGATION interface CarBody { fun getDoorCount(): Int } class
CarBodyImpl() : CarBody { override fun getDoorCount() = 4 } class Car(c: CarBody) : CarBody by c #demoday
KOTLIN: DELEGATION interface CarBody { fun getDoorCount(): Int } class
CarBodyImpl() : CarBody { override fun getDoorCount() = 4 } class Car(c: CarBody) : CarBody by c #demoday
KOTLIN: DELEGATION interface CarBody { fun getDoorCount(): Int } class
CarBodyImpl() : CarBody { override fun getDoorCount() = 4 } class Car(c: CarBody) : CarBody by c #demoday
KOTLIN: DELEGATION interface CarBody { fun getDoorCount(): Int } class
CarBodyImpl() : CarBody { override fun getDoorCount() = 4 } class Car(c: CarBody) : CarBody by c fun main(args: Array<String>) { val car = Car(CarBodyImpl()).getDoorCount() println(car) } #demoday
Delegated properties KOTLIN: DELEGATION #properties
KOTLIN: DELEGATION class Car { val bodyWeight: Int by CarBodyWight()
} #demoday
http:// lab.mobi designing & developing for mobile thanks Questions?