Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How to do delegation in Kotlin
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Harri Kirik
February 05, 2018
Programming
0
39
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
83
Support for HSM-like capabilities in Android
harri35
0
140
Why doesn't my in-app QR code work (on location)?
harri35
0
34
Git merge-base
harri35
1
73
Smoke testing your library
harri35
0
28
Collections in Kotlin
harri35
0
36
Data classes in Kotlin
harri35
0
34
Two-factor authentication at GDG Riga
harri35
0
74
Two-factor authentication at GDG Tartu
harri35
0
57
Other Decks in Programming
See All in Programming
SourceGeneratorのマーカー属性問題について
htkym
0
190
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
360
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
200
Claude Codeログ基盤の構築
giginet
PRO
7
2.9k
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
260
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
160
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
15
8.5k
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
220
Goの型安全性で実現する複数プロダクトの権限管理
ishikawa_pro
1
260
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
5
900
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
120
Docコメントで始める簡単ガードレール
keisukeikeda
1
110
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
330
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
390
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
170
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
210
Product Roadmaps are Hard
iamctodd
PRO
55
12k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
270
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?