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
Harri Kirik
February 05, 2018
Programming
0
34
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
31
Git merge-base
harri35
1
71
Smoke testing your library
harri35
0
26
Collections in Kotlin
harri35
0
34
Data classes in Kotlin
harri35
0
33
Two-factor authentication at GDG Riga
harri35
0
72
Two-factor authentication at GDG Tartu
harri35
0
55
Other Decks in Programming
See All in Programming
私の後悔をAWS DMSで解決した話
hiramax
4
210
FindyにおけるTakumi活用と脆弱性管理のこれから
rvirus0817
0
520
Amazon RDS 向けに提供されている MCP Server と仕組みを調べてみた/jawsug-okayama-2025-aurora-mcp
takahashiikki
1
110
AWS発のAIエディタKiroを使ってみた
iriikeita
1
190
Rancher と Terraform
fufuhu
2
550
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.8k
Swift Updates - Learn Languages 2025
koher
2
490
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
320
ユーザーも開発者も悩ませない TV アプリ開発 ~Compose の内部実装から学ぶフォーカス制御~
taked137
0
180
今から始めるClaude Code入門〜AIコーディングエージェントの歴史と導入〜
nokomoro3
0
200
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
Featured
See All Featured
Music & Morning Musume
bryan
46
6.8k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
The Cult of Friendly URLs
andyhume
79
6.6k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
580
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
113
20k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
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?