In Method Overloading Return Type Is Different
In Method Overloading Return Type Is Different. But return type alone is not sufficient for the compiler to determine which method is to be Edit: The "In short" answer applies to overloading strictly by return type. One more thing I would like to add is function overloading is providing a function with the same name, but with a different signature. but the return type of a method is not considered as a part of the.
The compiler can't figure out what type to use if we don't tell it in your hypothetical language. Method Overloading is a way to achieve Compile time polymorphism. Even though the return type of methods is different, it is not a valid case.
Even though the return type of methods is different, it is not a valid case.
Consider the following example, which have two methods that add numbers of different type Method Overloading is the common way of implementing polymorphism.
The parameter list in parenthesis—a comma-delimited list of input. The return type—the data type of the value returned by the method, or void if the method does not return a value. The return type of the methods can or can not be be same, but the parameter should be different.
0 Response to "In Method Overloading Return Type Is Different"
Posting Komentar