创建节点时出错 [英] Error creating a node

查看:66
本文介绍了创建节点时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建自己的链表实现,只是为了获得一些稍微高级的C ++的基本知识。我有下面的课程,但我得到

错误说错误C2629:意外节点('''在线上为

重叠构造函数Node(char xiType)

有谁可以告诉我哪里出错了?

谢谢

Allan

#include< iostream>


class Node

{

public:

Node() ;

Node(char xiType);

virtual~Node();


void SetNextLink(Node * xiNode){NextNode = xiNode);

void SetPrevLink(Node * xiNode){PrevNode = xiNode};

Node * GetPrevLink(){return PrevNode;}

节点* GetNextLink(){return NextNode;}

void SetData(void * xiData){Data = xiData;}

void * GetData(){return Data;}

私人:

节点* NextNode;

节点* PrevNode;

void *数据;

bool Tail;

bool Head;

};

解决方案



" Allan Bruce" <人***** @ TAKEAWAYf2s.com>在消息新闻中写道:br ********** @ news.freedom2surf.net ...

我正在制作自己的链表实现只是为了得到一些基本的
了解更先进的C ++。我有下面的课程,但是我得到了一个错误,上面写着错误C2629:意外节点('''在线上为重叠的构造函数Node(char xiType)




你确定上一行真的有一个分号吗?




" Ron Natalie"< ro*@sensor.com>写在消息中

新闻:3f * ********************@news.newshosting.com ..


Allan Bruce< al * **** @ TAKEAWAYf2s.com>写在留言



news:br ********** @ news.freedom2surf.net ...

我正在创建自己的链表实现,只是为了获得一些稍微高级的C ++的基本知识。我有下面的课程,但是我
得到一个错误说错误C2629:意外'节点('''我i s为
为重叠的构造函数Node(char xiType)
任何人都可以告诉我哪里出错了吗?



你确定上一行是真的吗?最后有一个分号?




在此之前没有其他课程,但他们都有分号

在课程定义的最后。

Allan


Allan Bruce写道:

" Ron Natalie < ro*@sensor.com>在消息中写道
新闻:3f ********************* @ news.newshosting.com。 ..

" Allan Bruce" <人***** @ TAKEAWAYf2s.com>在消息中写道



新闻:br ********** @ news.freedom2surf.net ...

< blockquote class =post_quotes>我正在创建自己的链表实现,只是为了获得一些稍微高级的C ++的基本知识。我有下面的课程,但是我得到了一个错误,上面写着错误C2629:意外节点('''在线就是

重叠构造函数Node(char xiType)
任何人都可以告诉我哪里出错了吗?



你确定上一行真的有一个分号吗?



在此之前没有其他类,但它们在类定义的末尾都有分号。
Allan




不,Ron的意思是你绝对确定在默认构造函数后面有分号,而不是冒号吗?

即你重新打字,或者你剪切和粘贴了吗?


I am making my own linked list implementation just to get some basic
knowledge of slightly more advanced C++. I have the class below, but I get
an error saying "error C2629: unexpected ''Node (''" which is on the line for
the overlaoded constructor Node(char xiType)
Can anybody tell me where I am going wrong?
Thanks
Allan
#include <iostream>

class Node
{
public:
Node();
Node(char xiType);
virtual ~Node();

void SetNextLink(Node *xiNode){NextNode = xiNode);
void SetPrevLink(Node *xiNode){PrevNode = xiNode);
Node *GetPrevLink(){return PrevNode;}
Node *GetNextLink(){return NextNode;}
void SetData(void *xiData){Data = xiData;}
void *GetData(){return Data;}
private:
Node *NextNode;
Node *PrevNode;
void *Data;
bool Tail;
bool Head;
};

解决方案


"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message news:br**********@news.freedom2surf.net...

I am making my own linked list implementation just to get some basic
knowledge of slightly more advanced C++. I have the class below, but I get
an error saying "error C2629: unexpected ''Node (''" which is on the line for
the overlaoded constructor Node(char xiType)
Can anybody tell me where I am going wrong?



Are you sure the previous line really has a semicolon at the end of it?



"Ron Natalie" <ro*@sensor.com> wrote in message
news:3f*********************@news.newshosting.com. ..


"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message


news:br**********@news.freedom2surf.net...

I am making my own linked list implementation just to get some basic
knowledge of slightly more advanced C++. I have the class below, but I get an error saying "error C2629: unexpected ''Node (''" which is on the line for the overlaoded constructor Node(char xiType)
Can anybody tell me where I am going wrong?



Are you sure the previous line really has a semicolon at the end of it?



There are no other classes before this one, but they do all have semi-colons
at the end of the class definitions.
Allan


Allan Bruce wrote:

"Ron Natalie" <ro*@sensor.com> wrote in message
news:3f*********************@news.newshosting.com. ..

"Allan Bruce" <al*****@TAKEAWAYf2s.com> wrote in message



news:br**********@news.freedom2surf.net...

I am making my own linked list implementation just to get some basic
knowledge of slightly more advanced C++. I have the class below, but I
get
an error saying "error C2629: unexpected ''Node (''" which is on the line
for
the overlaoded constructor Node(char xiType)
Can anybody tell me where I am going wrong?



Are you sure the previous line really has a semicolon at the end of it?


There are no other classes before this one, but they do all have semi-colons
at the end of the class definitions.
Allan



No, Ron meant are you absolutely sure that you have a semicolon after the default constructor, and not a colon?
i.e. did you retype, or did you cut&paste?


这篇关于创建节点时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆