我有以下类,我尝试访问基类的受保护成员,但在 eclipse 中出现错误“无法解析字段分解”。有人可以向我解释我做错了什么吗?为什么我无法访问变量mFactorized
?
基类
template <typename ValueType>
class AbstractDirectLinearSolver{
protected:
bool mFactorized;
public:
//Constructors, destructor
AbstractDirectLinearSolver(){
mFactorized = false;
}
virtual ~AbstractDirectLinearSolver();
//Methods
virtual void Solve(Vector<ValueType>& x, const Vector<ValueType>& b) const = 0;
virtual void Factorize(AbstractMatrix<ValueType>& A) = 0;
};
派生类
#include "AbstractDirectLinearSolver.hpp"
template<typename ValueType>
class CholeskySolver: public AbstractDirectLinearSolver {
private:
AbstractMatrix<ValueType> *mR; //Pointer = Abstract class NOT ALLOWS instantiation !!
public:
CholeskySolver() {
mR = NULL;
}
~CholeskySolver() {
if (this->mFactorized) { //ERROR HERE
delete mR;
}
}
void Solve(const Vector<ValueType>& x, const Vector<ValueType>& b) {
Vector<ValueType> y(mR->ApplyLowInv(b));
x = mR->ApplyLowerTransponse(y);
}
void Factorize(AbstractMatrix<ValueType>& A) {
if (mR != NULL)
delete mR;
mR = NULL;
A.CholeskyFactorization(mR);
this->mFactorized; //ERROR HERE
}
};