Why we cannot use return value types to distinguish overloaded methods?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Why we cannot use return value types to distinguish overloaded methods??

27th Feb 2017, 6:33 AM
JITENDRA MAURYA
JITENDRA MAURYA - avatar
2 Respostas
+ 1
Because compiler have have a clue which method you want him to call based on return value, if that makes sense to you. You dont point out return type when calling a method just its name. if methods have same parameters there is no chance to diatinguish which to call.
27th Feb 2017, 6:38 AM
Ladislav Milunović
Ladislav Milunović - avatar
0
doesn't have a clue***
27th Feb 2017, 6:39 AM
Ladislav Milunović
Ladislav Milunović - avatar