Scala inherit parameterized constructor

后端 未结 4 1018
不知归路
不知归路 2021-02-02 09:53

I have an abstract base class with several optional parameters:

abstract case class Hypothesis(
    requirement: Boolean = false,
    onlyDays:   Seq[Int] = Nil,         


        
4条回答
  •  自闭症患者
    2021-02-02 10:43

    If Hypothesis is an abstract class, then I'd not have a constructor for it. I'd set those parameters as abstract attributes of the abstract class.

    But then, in this case you do need the override modifier.

提交回复
热议问题