might be a bit of a coward-ish question: I've got two classes, and declared all variables public. Why can't I access the variables from derived class??
g++ tells me: vec3d.h:76:3: error: ‘val’ was not declared in this scope
template<typename TYPE>
class vec{
public:
/**
* \var *val
* \brief *val is a pointer on a dynamically allocated array of TYPES
*/
TYPE *val;
/**
* \var dimension
* \brief an integer value storing the size of the array
*/
int dimension;
public:
/**
* \fn vec()
* \brief (constructor)
*
* With no arguments an array of one TYPE is set up, and filled with 0
*/
vec();
/**
* \fn vec( TYPE right )
* \brief (constructor)
* \param[in] right the value the vector will be initialised with
*/
vec( TYPE right );
/**
* \fn vec( TYPE right, int _dimension )
* \brief (constructor)
* \param[in] right the value all vector fields are initialised with
* \param[in] _dimension the size of the array
*/
vec( TYPE right, int _dimension );
[etc]
template<typename TYPE>
class vec3d : public vec<TYPE>{
public:
/**
* \fn vec3d()
* \brief (constructor)
*
* With no arguments an array of 3 TYPEs is set up, and filled with 0
*/
vec3d() : vec<TYPE>( 0, 3 ){};
/**
* \fn vec3d( TYPE right )
* \brief (constructor)
* \param[in] right the value the vector will be initialised with
*/
vec3d( TYPE right ) : vec<TYPE>( right, 3 ){};
/**
* \fn vec3d( TYPE X_val, TYPE Y_val, TYPE Z_val )
* \brief (constructor)
* \param[in] X_val the value vec3d[0] fiels is initialised with
* \param[in] Y_val the value vec3d[1] fiels is initialised with
* \param[in] Z_val the value vec3d[2] fiels is initialised with
*/
vec3d( TYPE X_val, TYPE Y_val, TYPE Z_val ) : vec<TYPE>( 0, 3 ){
val[0] = X_val; //// <----------THIS ONE FAILS!
val[1] = Y_val;
val[2] = Z_val;
};
[etc]