Salut,
j'ai ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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;  
      }
   }
}
Mon probleme est au niveau des deux constructeurs ayant pour arguments panier p et l'autre Fruit[] f, en fait je ne comprends vraiment la différence entre les deux,
qu est ce que ca change de mettre un objet de type panier en argument par rapport à lattribut Fruit[] f ?
merci de m'éclairer