I am new to C++, I have a very simple program but it can't be compiled.
Darray.h
#ifdef DARRAY_H
#define DARRAY_H
namespace myspace{
template<class T>
class DynamicTypeArray{
public:
DynamicTypeArray();
private:
int length;
};
}
#endif
Darray.cpp
#include "Darray.h"
namespace myspace{
template <class T>
DynamicTypeArray<T>::DynamicTypeArray(){
length = 0;
}
}
I think it is pretty straightforward, but when I try to compile it with
g++ Darray.cpp
it gives me an error
unknown type name 'DynamicTypeArray'
Am I doing anything wrong here? The problem drives me crazy right now.
Thank you