Created
November 19, 2014 06:12
-
-
Save yutaono/a9592e43c456dab6d09c to your computer and use it in GitHub Desktop.
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
trait Greeter { | |
val s: String | |
def greet(): String = s"greet! $s" | |
} | |
object Greeter { | |
implicit def convertInt(i: Int): Greeter = new Greeter { val s = i.toString } | |
} | |
import Greeter._ | |
object Main extends App { | |
println(1.greet()) | |
} |
Author
yutaono
commented
Nov 19, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment