Not sure what you got to work but this minimal sketch shows how it can be done with inheritance. If you run the sketch you will see that the manifold method will accept 2 objects of type Shapes2D but inside the method we can call methods in the actual class.
public void setup() {
Manifold m = new Manifold();
Circle c = new Circle(60, 80, 25);
Box b = new Box(20,40, 115, 55);
m.haveCollided(b, c);
}
class Manifold {
boolean haveCollided(Shape2D s0, Shape2D s1) {
s0.desc();
s1.desc();
return false;
}
}
abstract class Shape2D {
float x;
float y;
Shape2D(float x, float y) {
this.x = x;
this.y = y;
}
abstract void desc();
}
class Box extends Shape2D {
float w;
float h;
Box(float x, float y, float w, float h) {
super(x, y);
this.w = w;
this.h = h;
}
void desc() {
println("Box @", x, y, "size=", w, h);
}
}
class Circle extends Shape2D {
float r;
Circle(float x, float y, float r) {
super(x, y);
this.r = r;
}
void desc() {
println("Circle @ ", x, y, "radius = ", r);
}
}