class extends
in
Programming Questions
•
10 months ago
i dont understand what could i do with my sketch.
"The error specified is implicit superconstructor Taquin is undefined . must explicitely invoke antoher constructor."
but i declared and intialised my class.
i dont understand what i need to do , because before i used some times classes extended but i never got this error.
Taquin[][] taquin;
Taquinvide taquinvide;
int cols=2;
int rows=2;
int numbdiv;
int numbPieces;
int interval;
void setup() {
size(800, 800);
int numbdiv=2;
numbPieces=int(sq(numbdiv)-1);
interval = width/numbdiv;
taquin = new Taquin[cols][rows];
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
// Initialize each object
taquin[i][j] = new Taquin(i*interval, j*interval, interval, interval);
}
}
taquinvide=new Taquinvide(width-interval, height-interval, interval, interval);
}
void draw() {
background(0);
taquinvide.display();
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
taquin[i][j].display();
}
}
}
class Taquin {
float x, y;
float w, h;
Taquin(float tempX, float tempY, float tempW, float tempH) {
x = tempX;
y = tempY;
w = tempW;
h = tempH;
}
void display() {
rect(x, y, w, h);
}
}
class Taquinvide extends Taquin {
float x0, y0;
float w0, h0;
Taquinvide(float tempX0, float tempY0, float tempW0, float tempH0) {
x0 = tempX0;
y0 = tempY0;
w0 = tempW0;
h0 = tempH0;
}
void display() {
fill(100);
rect(x, y, w, h);
}
}
1