First of all, here's my abstract class:
public abstract class GeometricObject2D implements Comparable {
public abstract boolean contains(GeometricObject2D g);
public abstract boolean contains(double x, double y);
public abstract boolean overlaps(GeometricObject2D g);
public abstract int compareTo(Object temp);
public abstract double getArea();
public abstract double getPerimeter();
}
I'm supposed to extend it with two other classes, ComparableCircle2D and ComparableRectangle2D. Both contain all of the methods, except that they use their own arguments in the contains and overlaps methods, e.g:
public class ComparableCircle2D extends GeometricObject2D {
//...
public boolean contains(ComparableCircle2D circle){
//method
}
//...
public boolean overlaps(ComparableCircle2D circle){
//method
}
//...
}
This is the error I get:
Error:(1, 8) java: ComparableCircle2D is not abstract and does not override abstract method overlaps(GeometricObject2D) in GeometricObject2D.
Same goes for the other class. I don't fully understand what's wrong, so an explanation and a solution would be greatly appreciated.
P.S: The arguments have to stay the same.
Comparable, i.eimplements Comparable<Geometric2DObject>andcompareTo(Geometric2DObject other).