我已经开始为我需要的库编写一些代码。以下代码给了我一个错误
class node {
public:
node() { }
node(const node&);
~node() { }
luint getID() { return this->ID; }
node& operator=(const node&);
protected:
luint ID;
std::vector<node*> neighbors;
};
node::node( const node& inNode) {
*this = inNode;
}
node& node::operator=(const node& inNode) {
ID = inNode.getID();
}
如下:
graph.cpp:在成员函数'node& node::operator=(const node&)'中:graph.cpp:16:错误:将'const node'作为'luint node::getID()'的'this'参数传递会丢弃限定符
我对代码做错了什么吗?
谢谢,