I am writing a template class to function as a dynamic array and I am stumbling at one issue and cannot work out what's wrong. I have goggled it and come up with nothing but have fixed one issue that is similar by adding the class name and the variable size but still get these two. Here is the code
template<class Val>
class DynamArray
{
private:
const int kSegmentSize = 15;
int countPos;
Val initial[DynamArray::kSegmentSize];
public:
DynamArray::DynamArray();
DynamArray::~DynamArray();
void DynamArray::PutVal(Val value);
Val DynamArray::GetVal();
};
The array initial is causing the error to fix the first issue I added the DynamArray:: and the error disappeared but this one remains and I have no idea remaining here is a copy of the full error.
error C2327: 'DynamArray<std::string>::kSegmentSize' : is not a type name, static, or enumerator
Then I get
error C2065: 'kSegmentSize' : undeclared identifier
If anyone has any ideas about this they would be appreciated.