February 2014
Beginner
1248 pages
62h 25m
English
In discussing the logical names of methods used by the compiler, we did not mention the return types of the methods. Method calls cannot be distinguished only by return type. If you had overloaded methods that differed only by their return types and you called one of the methods in a standalone statement as in:
square(2);
the compiler would not be able to determine the version of the method to call, because the return value is ignored. When two methods have the same signature and different return types, the compiler issues an error message indicating that the method is already defined in the class. Overloaded methods can have different return types if the methods have different parameter lists. Also, overloaded ...
Read now
Unlock full access