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
40
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to do delegation in Kotlin
5 minute talk about delegation in Kotlin programming language.
Harri Kirik
February 05, 2018
More Decks by Harri Kirik
See All by Harri Kirik
Secure programming techniques: Mobile Development Security guest lecture
harri35
0
87
Support for HSM-like capabilities in Android
harri35
0
150
Why doesn't my in-app QR code work (on location)?
harri35
0
38
Git merge-base
harri35
1
81
Smoke testing your library
harri35
0
30
Collections in Kotlin
harri35
0
38
Data classes in Kotlin
harri35
0
40
Two-factor authentication at GDG Riga
harri35
0
78
Two-factor authentication at GDG Tartu
harri35
0
62
Other Decks in Programming
See All in Programming
Oxlintのカスタムルールの現況
syumai
6
1.1k
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
220
ローカルLLMでどこまでコードが書けるか -拡張版 / How much code can be written on a local LLM Extended
kishida
2
980
正しくソフトウェアを作る、前提を疑うための認知の視点 / doubt-premise
minodriven
20
6.5k
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
120
JavaDoc 再入門
nagise
0
320
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
150
Modding RubyKaigi for Myself
yui_knk
0
920
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
710
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
決定論的オーケストレーションの設計と実装 / Design and Implementation of Deterministic Orchestration
nrslib
3
1.3k
さぁV100、メモリをお食べ・・・
nilpe
0
140
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
200
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
310
BBQ
matthewcrist
89
10k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Thoughts on Productivity
jonyablonski
76
5.2k
Google's AI Overviews - The New Search
badams
0
1k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The agentic SEO stack - context over prompts
schlessera
0
810
The Language of Interfaces
destraynor
162
27k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Heart Work Chapter 1 - Part 1
lfama
PRO
7
36k
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?