Skip to content

Instantly share code, notes, and snippets.

@vodamiro
Created October 17, 2018 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vodamiro/bb596da386238dab91ccfce77ee29031 to your computer and use it in GitHub Desktop.
Save vodamiro/bb596da386238dab91ccfce77ee29031 to your computer and use it in GitHub Desktop.
Delegation of interface
interface MyInterface {
fun methodA()
fun methodB()
}
class MyInterfaceImp: MyInterface {
override fun methodA() {
println("A")
}
override fun methodB() {
println("B")
}
}
class FacadeImplOfMyInterface(private val originalMyInterface: MyInterfaceImp): MyInterface by originalMyInterface {
override fun methodA() {
println("overriden A")
originalMyInterface.methodA()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment