1 min readAug 5, 2019
Hi Sviatoslav Melnychenko. This is a kotlin’s Delegation Pattern. With that you can easily decorate things (so for me this thing actually helps to implement Decorator pattern):
interface Sample {
fun method1()
fun method2(arg: String)
fun method3(): String
fun method4()
}
class Implementation : Sample {
//...
}
class Decorator(sample: Sample) : Sample by sample {
//...now you able to implement not all 4 methods,
//but only those, you needed
}