Created
October 17, 2018 10:01
-
-
Save vodamiro/bb596da386238dab91ccfce77ee29031 to your computer and use it in GitHub Desktop.
Delegation of interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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