Member is inaccessible from friend class
I have a declaration like this
#include "Output/PtPathWriter.h"
// class PtPathWriter // I've also tried forward declaring the friend class
// leg data is a class designed to hold data for a single leg.
class PtP开发者_如何学CathLeg
{
friend class PtPathWriter; // doesn't work
//friend void PTPathWriter::writeToFile(string fileName, PtPath* path); // works
protected:
vector<map<int, shared_ptr<BoardingStopAlternative>>> m_boarding_stop_alternatives;
// some other stuff
}
However I get an error from PtPathWriter saying
PtPathWriter.cpp(44): error #308: member "PtPathLeg::m_boarding_stop_alternatives" (declared at line 79 of "../include/Paths/PtPathLeg.h") is inaccessible
1> path->m_leg_data.at(legnr).m_boarding_stop_alternatives.at(stopId);
Interestingly, if I use the alternate friend declaration (which specifies the method explicitly) it does work? Any thoughts on why they are different?
Using Intel C++ Compiler 11.1.065 btw.
Your little t
should be a capital T
in P**t**PathWriter
.
精彩评论