You mean something like:
abstract class A protected (val slot: Int) { protected def this() = this(0) } abstract class B protected (value: Int) extends A(value) { protected def this() = this(0) } class C extends B(3) { }
There is, AFAIK, there is no way to get around the primary constructor from one of the secondary forms, i.e. The following will not work:
abstract class B protected (value: Int) extends A(value) { protected def this() = super() }
All forms of secondary constructors must call primary. From the language specification (5.3.1 Constructor Definitions):
A class, in addition to the main constructor, may have additional constructors. These are defined by design definitions of the form def this (ps1) ... (psn) = e. Such a definition introduces an additional constructor for the encompassing class, with the parameters specified in the formal parameter lists ps1, ..., psn and the evaluation of which is determined by the expression of the constructor e. The volume of each formal parameter is equal to the subsequent sections of the parameters and the expression of the constructor e. The constructor expression is a call to self constructor this (args1) ... (argsn) or a block that starts with a call to self constructor
(a main attention).
source share