Ton problème doit se trouve à l'implémentaion de tes classe, je pense.
pour initialisé une variable constant a la construction d'un classe il faut que tu utilise cette syntaxe.
nomclasse::nomclasse (parmètre) :
nomvariable (valeur),
nomvariable (valeur)
{
pour une constant toujours avec une initialisation comme ci-dessus.
}
exemple d'utilisation :
-------------------------------------------------------
#include <iostream>
using namespace std ;
class test {
private:
const int cp ;
int courant;
string texte ;
public:
test() ;
test(string,int);
test(test&) ;
~test() {} ;
} ;
test::test(string l, int c):
cp(c), courant(c+2), texte(l) {
cout<<cp<<" | "<<courant<<" | "<<texte<<endl ;
}
test::test():
cp(1), courant(2), texte("rien") {
cout<<cp<<" | "<<courant<<" | "<<texte<<endl ;
}
test::test(test&c):
cp(c.cp), courant(c.courant+2), texte(c.texte) {
cout<<cp<<" | "<<courant<<" | "<<texte<<endl ;
}
int main (){
test *t=new test ("azerty", 1) ;
test *m=new test (*t) ;
delete t ;
delete m ;
return 0 ;
}
--------------------------------------------------------------------------------
J'espère avoir répondu à ton problème