0

I have a templated base class and a templated derived class. The compiler complains with

Error   C3861   'Item': identifier not found    
Error   C3861   'Max': identifier not found 

while looking at the definition of the constructor of Array.

Why can't the derived class access the base members ?

template<typename Element> class Array
{
public:
    Array() { Item = 0; Max = 0; }

    Element* Item;
    int Max;
};

template<typename Element, int Range> class StaticArray : public Array<Element>
{
public:
    StaticArray() { Item = Store; Max = Range; }

    int Store[Range];
};
Yves Daoust
  • 53,540
  • 8
  • 41
  • 94

0 Answers0