Created
November 19, 2016 18:21
-
-
Save edmundnoble/68e5cdc93947e914309a927dfb2748f2 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
scala> sealed trait B | |
defined trait B | |
scala> case class A(i: Int) extends B | |
defined class A | |
scala> implicit class AOps(a: A) { | |
| def stuff: Unit = println("A") | |
| } | |
defined class AOps | |
scala> implicit class BOps(b: B) { | |
| def stuff: Unit = println("B") | |
| } | |
defined class BOps | |
scala> A(1).stuff | |
A | |
scala> new B {}.stuff | |
B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment