dimanche 31 mai 2015

Issue with Constrcutors with templates

Given below are is my cpp code.i have written both declaration and defunition in same cpp file because there are templates in this code and i got some errors when i had two seperate files for header and code.so i had to write everything in same file.Still, i have errors with constructor declaration and definition. Why is this throwing the below error, is there something which am missing.

template<class T>
class Linklist
{
public:
Linklist();
Linklist(Linklist<T> & a);
~Linklist();
}     
template<class T>
Linklist<T>::Linklist()
{
}
template<class T>
Linklist::Linklist(Linklist<T> & a) 
{
} 

Error C2244: 'Linklist::{ctor}' : unable to match function definition to an existing declaration definition 'Linklist::Linklist(Linklist &)' existing declarations 'Linklist::Linklist(Linklist &)' 'Linklist::Linklist(void)'

Aucun commentaire:

Enregistrer un commentaire