Hi @alb85,
Not sure if this is what you are looking for,
This case implements an interface and a class is then defined and used. To create a new instance of a class Test, call Test_name = new Test();
interface Dot {
void move();
void display();
}
class CircleDot implements Dot {
float x = 50;
float y = 50;
void move() {
x = x + random(-1, 1);
}
void display() {
ellipse(x, y, 16, 16);
}
}
class SquareDot implements Dot {
float x = 50;
float y = 50;
void move() {
y = y + random(-1, 1);
}
void display() {
rect(x, y, 16, 16);
}
}
SquareDot sq;
void setup() {
size(100, 100);
sq = new SquareDot();
}
void draw() {
sq.move();
sq.display();
}