Last active
August 29, 2015 14:15
-
-
Save kamiyaowl/6fe23e9f7c807a21b919 to your computer and use it in GitHub Desktop.
implicit patrameter <<<< default parameter
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
def hoge(implicit str:String = "default", num:Int = 0) = println(str,num) | |
implicit val str2 = "implicit str2" | |
implicit val num2 = 123 | |
hoge()//(default,0) | |
hoge(str2,num2)//(implicit str2,123) | |
hoge(str2)//(implicit str2,0) | |
hoge(num = 456)//(default,456) | |
hoge(str = str2)//(implicit str2,0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment