Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
hubito98 authored Jan 6, 2025
1 parent 51c6ca8 commit 9e758c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/07_Delegation/01_delegationPattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ interface SoundBehavior {
fun makeSound()
}
class ScreamBehavior(val n:String): SoundBehavior { // 2
class ScreamBehavior(val n: String): SoundBehavior { // 2
override fun makeSound() = println("${n.uppercase()} !!!")
}
class RockAndRollBehavior(val n:String): SoundBehavior { // 2
class RockAndRollBehavior(val n: String): SoundBehavior { // 2
override fun makeSound() = println("I'm The King of Rock 'N' Roll: $n")
}
// Tom Araya is the "singer" of Slayer
class TomAraya(n:String): SoundBehavior by ScreamBehavior(n) // 3
class TomAraya(n: String): SoundBehavior by ScreamBehavior(n) // 3
// You should know ;)
class ElvisPresley(n:String): SoundBehavior by RockAndRollBehavior(n) // 3
class ElvisPresley(n: String): SoundBehavior by RockAndRollBehavior(n) // 3
fun main() {
val tomAraya = TomAraya("Thrash Metal")
Expand Down

0 comments on commit 9e758c1

Please sign in to comment.