Created
July 11, 2011 22:19
-
-
Save kiritsuku/1076930 to your computer and use it in GitHub Desktop.
Scala HelloWorld by self reference
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
object HelloWorld extends App { | |
val msg = new Hello with World | |
msg.show | |
} | |
trait Message { | |
def get: String | |
} | |
trait World extends Message { | |
def get = "World" | |
} | |
class Hello { | |
this: Message => | |
def show() { | |
println("Hello "+get) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment