Created
May 17, 2010 03:56
-
-
Save maiha/403383 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| [OK] | |
| def sum(a:Int,b:Int) = a+b | |
| [NG] | |
| def sum(a:Int,b:Int) = a+b | |
| def sum(a:Int,b:String) = sum(a, b.toInt) | |
| // (compile error) | |
| // overloaded method sum needs result type | |
| // def sum(a:Int,b:String) = sum(a, b.toInt) | |
| [OK] | |
| def sum(a:Int,b:Int) = a+b | |
| def sum(a:Int,b:String):Int = sum(a, b.toInt) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment