Need typename error (template related error)

后端 未结 2 501
野的像风
野的像风 2021-01-29 00:17

I have a class called node inside another class which is templated. Some of the methods of class Node returns Node pointer. This is an excerpt of how I implemented



        
2条回答
  •  耶瑟儿~
    2021-01-29 00:32

    How do I fix this problem?

    The compiler's error message s pretty clear about this point:
    To use nested classes, structs or typedefinitions from a template class you need to add the typename keyword to tell the compiler you want to use it as a type:

       template 
       typename myClass::Node* myClass::Node::getNext()  { // ...
    // ^^^^^^^^ << Add typename keyword
    

提交回复
热议问题