Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class is not a class template

Tags:

c++

oop

templates

i get the error : class is not a class template .Any idea why?

template<class T>
class nod{
          friend class lista<T>;
protected:
          T info;
          nod<T> *urm,*prec;
        };
like image 391
George Marin Avatar asked May 17 '15 13:05

George Marin


1 Answers

lista is not known yet at this point in the code. So of course the compiler doesn't think it's a template class. You need to forward declare it with its template arguments. See also: How to forward declare a C++ template class?

like image 142
tenfour Avatar answered Nov 15 '22 15:11

tenfour