Skip to content

Instantly share code, notes, and snippets.

@Shinpeim
Last active August 29, 2015 13:57
Show Gist options
  • Save Shinpeim/9722522 to your computer and use it in GitHub Desktop.
Save Shinpeim/9722522 to your computer and use it in GitHub Desktop.
object Nyan {
class A {
def nyan = "A"
}
implicit class B (self:A){
def nyan = "B"
def wan = "B"
}
def main(args:Array[String]) = {
val a = new A
println(a.nyan)
println(a.wan)
}
}
> run
[info] Compiling 1 Scala source to /Users/shinpei/nekogata/nyan/target/scala-2.10/classes...
[info] Running Nyan
A
B
[success] Total time: 1 s, completed 2014/03/23 21:39:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment