I have tried the following:
public class OuterClass
{
abstract class abstract AbstractInnerClass
{
final Object member;
public Abstract InnerClass(Object member) { this.member = member; }
}
public class InnerClass extends AbstractInnerClass { }
}
However, this gives me a compile fail:
Parent class has no 0-argument constructor for implicit construction
However I can change InnerClass
to:
public InnerClass extends AbstractInnerClass
{
public InnerClass(Object member) { super(member); }
}
Another change I can make indicates at least some constructors inherit:
public class AbstractInnerClass
{
Object member;
public AbstractInnerClass() { }
public AbstractInnerClass(Object member) { this.member = member; }
}
Thing is, I do not care about the 0-argument constructor and don't foresee ever having any use for it. I tried to make an abstract constructor:
public class AbstractInnerClass
{
Object member;
public abstract AbstractInnerClass(Object member) { this.member = member; }
}
Unfortunately the above also results in a compile fail:
Constructors cannot be abstract
Is there no way to inherit constructors?
public InnerClass(Object member) { super(member); }
I am looking for a way to inherit the constructor without needing to redefine it.