[Debutant] Problème avec un constructeur par copie
Bonjour,
J'essaye désespérément de créer un constructeur par copie :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Animation::Animation(const Animation &UneImage){
short int* cadre_tmp ;
short int* position_tmp;
short int* rvb_tmp ;
position_tmp = UneImage.RecupererPosition();
cadre_tmp = UneImage.RecupererCadre();
rvb_tmp = UneImage.RecupererCouleurTransparente();
//s'occupe de charger l'image
ModifierAnimation(UneImage.RecupererNom(),UneImage.RecupererType(),UneImage.RecupererChemin(),position_tmp[0] ,position_tmp[1],cadre_tmp[0],cadre_tmp[1],cadre_tmp[2],cadre_tmp[3],rvb_tmp[0] ,rvb_tmp[1] ,rvb_tmp[2]);
if (UneImage.RecupererFps() != FPS) temps.ModifierFps(UneImage.RecupererFps()) ;
}; |
Seulement une fois à la compilation, je tombe sur les erreurs de compilation suivante et je comprend pas du tout comment les résoudre :
Citation:
../Animation_Propre/Animation.cpp: In copy constructor ‘Animation::Animation(const Animation&)’:
../Animation_Propre/Animation.cpp:221: erreur: passing ‘const Animation’ as ‘this’ argument of ‘short int* Animation::RecupererPosition()’ discards qualifiers
../Animation_Propre/Animation.cpp:222: erreur: passing ‘const Animation’ as ‘this’ argument of ‘short int* Animation::RecupererCadre()’ discards qualifiers
../Animation_Propre/Animation.cpp:223: erreur: passing ‘const Animation’ as ‘this’ argument of ‘short int* Animation::RecupererCouleurTransparente()’ discards qualifiers
../Animation_Propre/Animation.cpp:227: erreur: passing ‘const Animation’ as ‘this’ argument of ‘char* Animation::RecupererNom()’ discards qualifiers
../Animation_Propre/Animation.cpp:227: erreur: passing ‘const Animation’ as ‘this’ argument of ‘typeAnimation Animation::RecupererType()’ discards qualifiers
../Animation_Propre/Animation.cpp:227: erreur: passing ‘const Animation’ as ‘this’ argument of ‘char* Animation::RecupererChemin()’ discards qualifiers
Si quelqu'un pouvait m'expliquer l'erreur et comment la resoudre je lui en serais grès.
merci