errors C3861 when compiling derived class template in VS2019

  • Thread starter Thread starter Geng88
  • Start date Start date
G

Geng88

Guest
Hello All,

The following code can be compiled successfully in VS2005 but the compilation failed in VS2019. The return error is C3861 as _ptr, _refr and _maxCol identifier not found.

template<typename T>
class CCol
{
public:
CCol();
CCol(binary_t<T>);
~CCol();

public:
int getMaxColumn() {return _maxCol;}

protected:
T *_ptr;
T *_refr;
int _maxCol;
};

template<typename T>
class CRow : public CCol<T>
{
public:
CRow();
CRow(binary_t<T>);
~CRow();

public:
CCol<T>& operator[](int);

private:
int _maxRow;
};

template<typename T>
CCol<T>& CRow<T>::operator [](int index_)
{
if (index_ > (_maxRow - 1))
index_ = (_maxRow - 1);

_ptr = (_refr + (index_ * _maxCol)); //C3861 error due to this line
return *this;
}

Does anyone know how to solve this? Hope I can find the answer at here.

Thanks in advance.

Continue reading...
 
Back
Top