I have below two classes ,
abstract class Shape {
protected DrawAPI drawAPI;
protected Shape(DrawAPI drawAPI){
this.drawAPI = drawAPI;
}
public abstract void draw();
}
class Circle extends Shape {
private int x, y, radius;
public Circle(int x, int y, int radius, DrawAPI drawAPI) {
//super(drawAPI);
this.x = x;
this.y = y;
this.radius = radius;
}
public void draw() {
drawAPI.drawCircle(radius,x,y);
}
}
I get an error in the constructor of Circle class if I don't add the commented line (//super(drawAPI)) . The error is constructor shape in class shape cannot be applied to given types. Actual and formal arguments Differ in length
I want to know why adding commented line fix the problem and what does it do ?