3
votes

class B(implicit imp: Int) extends AC { }

object C extends B{

}

Error: could not find implicit value for parameter imp

This is what i was looking for: How to provide default value for implicit parameters at class level

2
Since object does not have a constructor it cannot be done. But you can have a class extending the other class class B(implicit imp: Int) extends A(imp) - Eugene Ryzhikov

2 Answers

5
votes

You extend it like you extend a class with non-implicit parameters, but you need an empty parameter list first:

scala> object C extends B()(5) {}
defined module C
1
votes
scala> class B(implicit imp:Int)
defined class B

scala> class C extends B()(1)
defined class C

scala> implicit val imp:Int = 2
imp: Int = 2

scala> class D extends B
defined class D

scala>