使用protected
成员时遇到一些问题。相关代码和我得到的错误如下。这些类具有所有必需的函数和变量。我刚刚总结了相关部分。我该怎么办?
MFS.h:
class MFS
{
protected:
MatrixXd commandedLateral;
};
CSimulator.h:
class CSimulator : MFS
{
};
CSimulator.cpp:
void CSimulator::calculateactuator(MFS* mfs)
{
actuator = -gain * mfs->commandedLateral(1,0);
}
错误C2248:'MFS :: commandedLateral':无法访问在类'MFS'中声明的私有成员