I am trying to call the Size() function of base class Array. The error from Clang is "use of undeclared identifier 'Size'". Below is my header for NumericArray, function definition in source file, and function definition in base class. Many thanks for the help.
derived header
#ifndef NUMERICARRAY_H
#define NUMERICARRAY_H
#include "array.h"
namespace Cary
{
namespace Containers
{
template<typename T>
class NumericArray: public Array<T>
{
public:
NumericArray<T>(); //default constructor
~NumericArray<T>(); //destructor
NumericArray<T>& operator = (const NumericArray<T>& array1); //assignment operator
NumericArray<T>& operator * (double factor) const; //scale
NumericArray<T>& operator + (const NumericArray<T>& array1) const; //add
};
}
}
#endif
function definition in cpp
template<typename T>
NumericArray<T>& NumericArray<T>::operator * (double factor) const //scale
{
NumericArray<T> scale(Size());
for (int i = 0; i < Size(); i++)
scale[i] = factor * ((*this).GetElement(i));
return scale;
}
size function from base class
template<typename T>
int Array<T>::Size() const //returns size
{
return m_size;
}