我收到此错误:
SortedList.cpp:197: error: expected constructor, destructor, or type conversion before '*' token
这是代码:
197 Listnode *SortedList::copyList(Listnode *L) {
198 Listnode *current = L;
199
200 Listnode *copy = new Listnode;
201 copy->student = new Student(*current->student);
202 copy->next = NULL;
203
204 Listnode *head = copy;
205
206 current = current->next;
207 while (current != NULL) {
208 copy = copy->next = new Listnode;
209 copy->student = new Student(*current->student);
210 copy->next = NULL;
211 }
212 return head;
213 }
这是列表节点:
struct Listnode {
Student *student;
Listnode *next;
};
Listnode *head;
不知道我应该做什么。如果需要查看,我已经实现了构造函数和析构函数。关于问题可能是什么的任何见解都会有所帮助。