c++ - Issue with Constrcutors with templates -
given below cpp code.i have written both declaration , defunition in same cpp file because there templates in code , got errors when had 2 seperate files header , code.so had write in same file.still, have errors constructor declaration , definition. why throwing below error, there 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 match function definition existing declaration definition 'linklist::linklist(linklist &)' existing declarations 'linklist::linklist(linklist &)' 'linklist::linklist(void)'
original:
template<class t> linklist::linklist(linklist<t> & a) // forgot here... see below { } fixed:
template<class t> linklist<t>::linklist(linklist<t> & a) // <t> missing. { } and class declarations end ;, too.
Comments
Post a Comment