Is something like this possible
abstract class AbstractSuperClass {
private Entity entity;
public AbstractSuperClass(Entity entity) {
this.entity = entity;
}
public abstract void operate();
}
public class SubClass extends AbstractSuperClass {
public void operate() {
this.entity.doVoidMethod(); // is this.entity defined in instances of SubClass ?
}
}
// ... somewhere else
Entity instantiatedEntity = new Entity();
SubClass instance = new SubClass(instantiatedEntity);
instance.operate(); // does this call this.entity.doVoidMethod() inside of instance?
I want to be able to skip writing my own constructors in subclasses of an abstract class I'm writing. All of the constructors would be identical in every subclass.
If I skip writing a constructor for a subclass of an abstract class (is this even allowed?) does the abstract class' constructor get used by default?