Salut à tous, j'ai un bête problème de compilation:
Voila j'ai deux classes, BMULog et BMUMowerLog qui utilise BMULog (mais ne doit pas en dérivé). J'ai une méthode de lecture dans un fichier définit en private dans BMULog dont je voudrait que BMUMowerLog ait accès donc je déclare la fonction BMUMowerLog::ReadFromFile amis de BMULog::ReadFromFile et donc je suis obligé de déclarer BMULog après BMUMowerLog. Mais dès lors le compilateur râle un peu car il ne sais pas ce qu'est BMULog dans la déclaration de BMUMowerLog.
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
 
class BMUMowerLog
{
        public:
        std::string OwnerName;
        std::string OwnerSurname;
        std::string OwnerAddress;
        unsigned __int8  MowerType;
        std::map<BMULogTime,BMULog> Data; // Problème ICI car ne connait pas BMULog!!
        bool Insert(const BMULogTime &,const BMULog &);
        bool Insert(const BMULog &);
        bool SaveToFile(std::string);
        bool ReadFromFile(std::string);
        unsigned __int16 Count();
        BMULog* operator[](const BMULogTime&);
 
 
};
//---------------------------------------------------------------------------
class BMULog : public BMUSerialDump
{       private:
        bool ReadFromFile(std::ifstream&); // Doit être accessible par BMUMowerLog::ReadFromFile
        public:
        unsigned __int32 SNB;
        unsigned __int8  BootVersion;
        unsigned __int32 SoftVersion;
        BMULogTime Time;
        std::string LogInformation;    
        BMULog();
        BMULog(unsigned __int8*,unsigned __int16);
        BMULog(unsigned __int8*,unsigned __int16,std::string);
        unsigned __int32 Size();
        friend bool BMUMowerLog::ReadFromFile(std::string); 
 
};
Comment indiqué au compilateur (C++ Builder 6) qu'il trouvera la déclaration de BMULog après??

Merci