   [C++] Template inheritance
  I am trying to make an abstract generic vector class, but I keep getting errors.template <class T, unsigned int D>class Vector{private:public:    T m_Val[D];    Vector<T, D>()    {   for (int i = 0; i < D; ++i)  m_Val = 0;    }... etc};...template <class T> class Vector3 : public Vector<T, 3>{    T& X()    {   return m_Val[0];    }};What I want is that for a vector with dimension 3, I can access the elements by using x, y, z. I tried to do this with partial template specialization, but I keep getting the same error as now: ‘m_Val’ was not declared in this scope.What am I doing wrong?   
  Try Vector<T, 3>::m_Val[0];   ;  Or:    return this->m_Val[0];Explanation.;  Thanks :)   ;  A better option might be:template<typename Scalar, unsigned int Dimension>struct VectorBase {  // here you have the non-specialised base operators}; template<typename Scalar, unsigned int Dimension>struct Vector: VectorBase<Scalar, Dimension>{  // Here you implement some default Vector constructors/operators  // That don't get inherited from VectorBase.};template<typename Scalar>struct Vector<Scalar, 3>: public VectorBase< Scalar, 3 >{  // here you implement the Vector3 methods  // x(), y(), z() etc.  // By using specialisation instead of a new class,  // these methods 'happen for free'.};Having both Vector3<int> and Vector<int, 3> seems like overkill....If you want to go really crazy, you could even go as far as to support Vector< Vector<int, 3>, 3>.Is there any way you could support Vector< int[7][3] >?;  Template inheritance often solved by using this keyword in derived class in case you need to using base class info in derived class. 