You could create an abstract base class then extend that to two subclasses, one of those implementing an interface, then extend those subclasses to children that either need the interface or not.
Crab crab;
Octopus octo;
void setup() {
size(400, 400);
crab = new Crab();
octo = new Octopus();
crab.render();
octo.display();
}
interface IMonster {
void move();
}
abstract class Monster {
Monster() {
}
abstract void display();
}
class MonsterDynamic extends Monster implements IMonster {
MonsterDynamic() {
}
void display() {
println("I am a dynamic monster");
};
void move() {
println("watch me move");
};
}
class MonsterStatic extends Monster {
MonsterStatic() {
}
void display() {
println("I am a static monster");
};
}
// Crab moves
class Crab extends MonsterDynamic {
Crab() {
}
void display() {
println("Crab");
super.display();
}
void move() {
super.move();
}
void render() {
display();
move();
}
}
class Octopus extends MonsterStatic {
Octopus() {
}
void display() {
println("Octopus");
super.display();
}
}