Plusieurs const dans le prototype d'une fonction
	
	
		Bonjour, dans le code ci-dessous, au niveau de la ligne...
	Code:
	
const ChatDeGouttiere * const FonctionDeux(const ChatDeGouttiere * const leChat);
 ... j'ai compris que le troisième const sert à empêcher de modifier un membre de l'objet leChat, mais par contre, je ne vois pas à quoi pourrait servir les 3 autres const. Mais peut-être qu'ils ne servent pas dans ce cas précis.
	Code:
	
| 12
 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
 
 | #include <cstdlib>
#include <iostream>
 
using namespace std;
 
class ChatDeGouttiere
{
    public:
        ChatDeGouttiere();
        ChatDeGouttiere(ChatDeGouttiere &);
        ~ChatDeGouttiere();
 
        int LireAge() const { return wAge; }
        int DefAge(int age) { wAge = age; }
 
    private:
        int wAge;
};
 
const ChatDeGouttiere * const FonctionDeux(const ChatDeGouttiere * const leChat);
//const ChatDeGouttiere * const FonctionDeux(ChatDeGouttiere * const leChat);
 
int main(int argc, char *argv[])
{
    system("PAUSE");
    return EXIT_SUCCESS;
}
 
const ChatDeGouttiere * const FonctionDeux(const ChatDeGouttiere * const leChat) // ne compile pas : leChat est constant
//const ChatDeGouttiere * const FonctionDeux(ChatDeGouttiere * const leChat) // compile avec leChat->DefAge(8);
{
    leChat->DefAge(8);
    return leChat;
} | 
 Merci de m'éclairer. :zoubi: