Bonjour,
J'ai créé une liste chainé en c++. Pour cela j'ai deux classes : liste et maillon.
Elle marchait, mais j'ai voulu rajouter les templates et la sa marche plus. J'ai du mal transformer ma classe en template. Voici l'erreur à la compilation :
g++ -I/usr/openwin/include -c -Wno-deprecated Client.cc
Maillon.cc: In instantiation of ‘Maillon<float>’:
Liste.cc:18: instantiated from ‘Liste<T>& Liste<T>::operator+(T) [with T = float]’
Client.cc:9: instantiated from here
Maillon.cc:11: erreur: template argument required for ‘struct Liste’
Maillon.cc: In member function ‘void Liste<T>::affiche() const [with T = float]’:
Client.cc:10: instantiated from here
Maillon.cc:11: erreur: ‘Maillon<float>* Maillon<float>::suiv’ is private
Liste.cc:35: erreur: à l'intérieur du contexte
Maillon.cc:10: erreur: ‘float Maillon<float>::data’ is private
Liste.cc:36: erreur: à l'intérieur du contexte
Maillon.cc: In member function ‘Liste<T>& Liste<T>::operator+(Maillon<T>&) [with T = float]’:
Liste.cc:19: instantiated from ‘Liste<T>& Liste<T>::operator+(T) [with T = float]’
Client.cc:9: instantiated from here
Maillon.cc:11: erreur: ‘Maillon<float>* Maillon<float>::suiv’ is private
Liste.cc:26: erreur: à l'intérieur du contexte
make: *** [Client.o] Erreur 1Je suis depuis un moment sur l'erreur, mais je n'arrive pas à savoir pourquoi. Si vous pouviez m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part 
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

 

 
		
		 
         
 

 
			
			

 
			 
   


 erreur: template argument required for ‘struct Liste’
 erreur: template argument required for ‘struct Liste’
				 Répondre avec citation
  Répondre avec citation
Partager