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
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
83
Support for HSM-like capabilities in Android
harri35
0
140
Why doesn't my in-app QR code work (on location)?
harri35
0
33
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
Apache Iceberg V3 and migration to V3
tomtanaka
0
170
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
210
MUSUBIXとは
nahisaho
0
140
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6.1k
AI & Enginnering
codelynx
0
120
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.4k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
CSC307 Lecture 10
javiergs
PRO
1
660
高速開発のためのコード整理術
sutetotanuki
1
410
Featured
See All Featured
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
280
The Language of Interfaces
destraynor
162
26k
Paper Plane
katiecoart
PRO
0
46k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
94
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
180
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
920
Product Roadmaps are Hard
iamctodd
PRO
55
12k
How to Ace a Technical Interview
jacobian
281
24k
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?