class Algo {
def a( a : String = "Hola ", b : String = "adios" ) {
print( a )
print( b )
}
def a() {
print ("Uh?")
}
}
object Algo {
def main( args : Array[String] ) {
new Algo().a()
}
}
prints Uh?
If method a()
is not defined, the code prints "Hola adios" using the default values.
So, I deduce, from this, that, if an exact signature is match, that is preffered.
Is this reasoning correct?
This behavior is clearly defined in SID #1, section 3.1.
Overloading Resolution In a method application expression, when multiple overloaded alternatives are applicable, the alternative which use default arguments is never selected.