Is there a way to overload a constructor with more than just a one-line constructor? It seems like putting any more than one statement in an overloaded constructor gives the error Application does not take parameters
. For example, if the primary constructor take a String
, the following will work:
def this(num: Int) = {
this(num.toString())
}
The following, however, will not:
def this(num: Int) = {
val numAsString = num.toString()
this(numAsString)
}