我有一个基类:
class Base
{
public:
functions...
private:
std::vector<float> privateElement;
}
和一个派生的:
class Derived : public Base
{
public:
functions...
Derived(anotherElement) : privateElement(anotherElement)
{
}
}
我现在的问题是,每次我尝试构建我的项目时,编译器(gcc 4.7.2)总是抱怨无法访问privateElement
,例如:
class Derived does not have any field named privateElement
std::vector<float> Base::privateElement is private
有人可以在这里帮助我吗?