1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
class Panier {
Fruit[] t;
public Panier() {
this.t = new Fruit[0];
}
public Panier(Panier p) {
this.t = new Fruit[p.t.length];
for(int i = 0; i < p.t.length; i++) {
this.t[i] = p.t[i];
}
}
public Panier(Fruit[] f) {
this.t = new Fruit[f.length];
for(int i = 0; i < f.length; i++) {
this.t[i] = f[i];
}
}
public Panier(Fruit f, Panier p) {
if(p==null) {
this.t = new Fruit[1];
this.t[0] = f;
}
else {
this.t = new Fruit[p.t.length+1];
for(int i = 0; i < p.t.length; i++) {
this.t[i] = p.t[i];
}
this.t[p.t.length] = f;
}
}
} |
Partager