I want to have a constructor with an argument that gets inherited by all child classes automatically. But Java won't let me do this
class A {
A(int x) {
///
}
}
class B extends A {
}
class C extends A {
}
#Implicit super constructor A() is undefined for default constructor.
I dont want to have to write B(int x) and C(int x) etc for each child class. Is there a smarter way of approaching this problem.
Solution #1. Make an init() method that can be called after the constructor. This works, although for this particular design, I want to require the user to specify certain parameters in the constructor.