Given a Java class, something like
public abstract class A {
public A(URI u) {
}
}
I can extend it in Scala like this
class B(u: URI) extends A(u) { }
However, what I would like to do is alter the constructor of B, something like
case class Settings()
class B(settings: Settings) extends A {
// Handle settings
// Call A's constructor
}
What's the correct syntax for doing this in Scala?
Bor put that logic in anapplyof the companion object. Also, you can make the primary constructor ofBprivate to ensure users always use the alternative.