我有一个类管理文件的内容并将文件转换为二进制缓冲区,并且我有一个内部类,它是文件中的一个元素(基本上它代表一行)。像:我可以声明外部类的成员函数是内部类的朋友函数吗
class CSR{
private:
//some fields
public:
Elem operator[](int numRow);
//other methods
public:
class Elem{
private:
//other fields
public:
friend CSR::Elem CSR::operator[](int r);
};
};
编译器(VS 2012和快递)告诉“CSR没有成员operator []的”
你能指出编译器抱怨的行号吗?另外,什么是'SVDFeatureCSR'? – arne
@arne我声明朋友功能的行。我已经简单地将SVDFeatureCSR更改为CSR – zoujyjs