invalid use of template name without an argument list

前端 未结 1 1394
走了就别回头了
走了就别回头了 2021-02-01 03:05

I am facing a problem with my linked list class, I have created the interface and implementation files of the class, but when I build it, this error occurs: \"invalid use of tem

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-01 03:44

    Write it like this:

    template
    LinkedList::LinkedList()
    {
       start = nullptr;
       current = nullptr;
    }
    

    And similarly for other member functions. But you'll run into another problem - declarations and definitions of a template can't be separated to different files.

    0 讨论(0)
提交回复
热议问题