나는 extractHistogram()
구현 내에서 GHistogram
클래스의 빈에게 개인 멤버에 액세스하려고 할 때 다음과 같은 오류가 점점 오전 다음 extractHistogram()
구현이 친구 기능이 클래스의 개인 회원에 액세스 할 수없는 이유는 무엇입니까?
error: 'QVector<double> MyNamespace::GHistogram::bins' is private
error: within this context
어디에 '이 맥락에서'오류 지점을. 친구 함수 선언문에 무엇이 잘못되었는지 알 수 있습니까?
namespace MyNamespace{
class GHistogram
{
public:
GHistogram(qint32 numberOfBins);
qint32 getNumberOfBins();
/**
* Returns the frequency of the value i.
*/
double getValueAt(qint32 i);
friend GHistogram * MyNamespace::extractHistogram(GImage *image,
qint32 numberOfBins);
private:
QVector<double> bins;
};
GHistogram * extractHistogram(GImage * image,
qint32 numberOfBins);
} // End of MyNamespace
에 의해, 네임 스페이스 내에서 작성해야합니까? 당신은 친구로'Gbdi :: extractHistogram'을 가지고 있습니다. – quamrana
죄송합니다. Gbdi를 MyNamespace로 바꾸십시오. GBDI는 제가 일하는 연구 그룹의 이름입니다 ... –