I'm new to C++ but we're supposed to implement a provided template for a linked list. The error I'm getting says:
Code:
..\src\dlist.cc:3: error: expected constructor, destructor, or type conversion before '<' token
I get this error for my constructor methods in my .cc file. Without giving too much away, here is what my code looks like:
Code:
//Constructor
template <typename T>
Dlist<T>::Dlist()
{
makeEmpty();
}
//Copy constructor
template <typename T>
Dlist<T>::Dlist(const Dlist &l)
{
makeEmpty();
copyAll(l);
}
//Destructor
template <typename T>
Dlist<T>::~Dlist()
{
makeEmpty();
removeAll();
}
//Equals operator
template <typename T>
Dlist<T>& Dlist<T>::operator=(const Dlist &l)
{
if(this!=&l)
copyAll(l);
return *this;
}
//more methods
I'm certain that the header is correct because it was provided. I think I'm just doing something stupidly wrong.
PS. The other methods all say:
Code:
error: expected initializer before '<' token