Skip to content

Instantly share code, notes, and snippets.

@wispborne
Last active May 16, 2017 12:37
Show Gist options
  • Save wispborne/2b8b433a03b9a136b4943571254caf85 to your computer and use it in GitHub Desktop.
Save wispborne/2b8b433a03b9a136b4943571254caf85 to your computer and use it in GitHub Desktop.
class Barker : NoiseMaker {
override fun makeSound() {
println("Bark!")
}
}
class Dog : NoiseMaker {
private val barker = Barker()
override fun makeSound() {
// Delegate to the Barker class instead of implementing it here
barker.makeSound()
}
}
interface NoiseMaker {
fun makeSound()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment