Bonjour,

J'ai le code suivant(je sais, je me répète):
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
struct contain {
//...
}
class stack{
//...
public:
    T& get_front(); //get first element
    T& get_front(int); //get n-th element next start
//...
    bool operator==(stack);
    bool operator!=(stack);
    bool operator<(stack);
    bool operator>(stack);
    bool operator<=(stack);
    bool operator>=(stack);
 
    stack operator=(const stack &);
    stack operator=(const contain);
 
};
//...
template <class T> //contained type
T& stack<T>::get_front(void) {
    return dernier->donnee
}
template <class T> //contained type
T& stack<T>::get_front(int n) {//get n-th element next start
    if (n>num) {
        erreur error;
        error.msg="Out of range";
        error.errornum=2;
        throw (error);
    }
    contain *ptr;
    ptr=premier;
    for (int i=0;i<n;i++)
        ptr=ptr->suivant;
    return &ptr;
}
 
//...
template <class T> //contained type
bool stack<T>::operator!=(stack e) {
    if (size()!=e.size()) return true;
        for (int i=0;i<size;i++) {
            if (get_front(i)!=e.get_front(i))
                return true;
        }
    }
    return false;
//erreur de syntaxe : 'return'
}
//erreur de syntaxe : '}'
 
//...
L'erreur se situe sur les dernières lignes de code de cet extrait

Merci d'avance à tous,
ProgVal