Created
March 10, 2017 09:58
-
-
Save Phil-Ba/e841accdfbcd5f7ddfd0cd605da213ef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
trait Printer { | |
def print(s: String) = println(s) | |
} | |
trait UpperPrinter extends Printer { | |
override def print(s: String) = super.print(s.toUpperCase) | |
} | |
trait DoublePrinter extends Printer { | |
override def print(s: String) = super.print(s * 2) | |
} | |
trait PrettyPrinter extends Printer { | |
override def print(s: String) = super.print(s"*** $s ***") | |
} | |
val x = new {} with Printer with PrettyPrinter with DoublePrinter | |
x.print("hello") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment