I have an abstract base class with several optional parameters:
abstract case class Hypothesis(
requirement: Boolean = false,
onlyDays: Seq[Int] = Nil,
…
) extends Something {…}
Do i really need to explicitly repeat all parameters with the additional keywords override val on top‽
case class SomeHypothesis(
anotherArg: SomeType,
override val requirement: Boolean = false,
override val onlyDays: Seq[Int] = Nil,
…
) extends Hypothesis(
requirement,
onlyDays,
…
) {…}
Or is there a syntax like
case class SomeHypothesis(anotherArg: SomeType, **) extends Hypothesis(**) {…}
I don’t even need anotherArg, just a way to pass all keyword args to the super constructor.
I really like Scala’s idea about constructors, but if there isn’t a syntax for that one, I’ll be disappoint :(
overridein this situation. Since you're using a case class, all of the constructor parameters implicitly have thevalmodifier. Because of the name clash, you have to add an explicitoverridemodifier (and also an explicitvalmodifier, for the parser's happiness). My apologies for the hasty comment.