Say I have a parent class Emitter, with attributes
private double launchAngle;
private double launchAngleVariation;
and a constructor
public Emitter(double launchAngle, double launchAngleVariation)
{ this.launchAngle = launchAngle;
this.launchAngleVariation = launchAngleVariation;
}
and a child class MobileEmitter, with attribute
private int a;
and a constructor
public MobileEmitter(double launchAngle, int a)
{ super(); //how should this be handled?
this.a = a;}
My question is what is the best way to handle the super call?
Should I create an empty constructor in the parent class and make launchAngle protected so that I can assign the value directly in the child constructor?
Or is it better practice to create a separate constructor in the parent class with just launchAngle as a parameter then call super(launchAngle)
?