Hi All, I have begun writing some code for a library I need. The following code gives me an error
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();
}
which is the following:
graph.cpp: In member function 'node& node::operator=(const node&)': graph.cpp:16: error: passing 'const node' as 'this' argument of 'luint node::getID()' discards qualifiers
Did I do anything wrong with the code?
Thanks,