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 the method is a()not defined, the code prints "Hola adios" using the default values.
So, I inferred from this that if the exact signature matches, it is preferable.
Is this reasoning correct?
source
share