Created
March 3, 2019 12:41
-
-
Save dimastatz/edb6240ec31a15a47ac6923a53e6b4e4 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
object MyExtensions { | |
implicit def richInt(i: Int) = new { | |
def square: Int = i * i | |
} | |
} | |
object UsingExtension { | |
import MyExtensions._ | |
def run(): Int = { | |
val x: Int = 5 | |
x.square | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment