[英]error C2143: syntax error missing ')' before 'constant'
I'm a student using c++ in class. 我是一个在课堂上使用c ++的学生。 I did see this error in about three other questions, however, they were all solved by adding a basic arithmetic sign in front of a hard-coded number.
我在其他三个问题中确实看到了此错误,但是,通过在硬编码数字前面添加基本算术符号可以解决所有问题。 As I'm not doing arithmetic, I don't think they will help me here.
由于我不算术,因此我认为他们不会在这里帮助我。
For our assignment we're having to parse a bibliography and store the resulting entries into a linked list of entries. 对于我们的作业,我们必须解析书目并将结果条目存储到条目的链接列表中。 To that end, the book we're using has a linked list class, but it has errors.
为此,我们正在使用的书有一个链表类,但是有错误。 One of the error sets I can't figure out is:
我不知道的错误集之一是:
The offending line(s) are in a template header, and my question is what can I do to fix this? 令人反感的行位于模板标题中,我的问题是如何解决此问题? The code can be found here:
该代码可以在这里找到:
template <class DataType>
class LinkedList : public AbstractLinkedList<DataType>{
protected:
DataType* _info;
LinkedList<DataType>* _next;
void copy(const LinkedList<DataType>& 11); //first offending line
public:
LinkedList();
LinkedList(const LinkedList<DataType>& ll);
LinkedList(const DataType& info);
LinkedList(const DataType& info, LinkedList<DataType>* next);
~LinkedList();
};
template <class DataType>
void LinkedList<DataType>::copy(const LinkedList<DataType>& 11){ //second offending line
if(ll._info == NULL){
_info = NULL;
} else {
_info = new DataType(*(ll._info));
if(_info == NULL){
throw LinkedListMemory();
}
}
if(ll._next == NULL){
_next = NULL;
} else {
_next = new LinkedList<DataType>(*(ll._next));
if(_next == NULL){
throw LinkedListMemory();
}
}
}
I'm skipping over parts that aren't causing errors 我跳过了不会引起错误的零件
Things I've tried: 我尝试过的事情:
none of that fixed the problem and my understanding is without the "LinkedList'<'DataType>&" it can't really be used in a template form. 这些都不能解决问题,我的理解是没有“ LinkedList'<'DataType>&”,它实际上不能以模板形式使用。
11
(the number one, twice) is not a valid variable name; 11
(数字1,两次)不是有效的变量名; identifiers must start with a letter or underscore. 标识符必须以字母或下划线开头。
You probably meant ll
(the letter "l", twice, which could stand for "linked list"). 您可能用
ll
(字母“ l”,两次,它代表“链表”)。 It can be hard to distinguish l
from 1
in some fonts. 在某些字体中,很难将
l
与1
区分。
变量名不能以数字开头,因为一串数字既是有效的标识符又是有效的数字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.