Overload constructor for Scala’s Case Classes?
Overloading constructors isn’t special for case classes: case class Foo(bar: Int, baz: Int) { def this(bar: Int) = this(bar, 0) } new Foo(1, 2) new Foo(1) However, you may like to also overload the apply method in the companion object, which is called when you omit new. object Foo { def apply(bar: Int) = new … Read more