Please i'm working on a linked list and want to overload the ++
operator in order to use a dummy pointer to loop/traverse through the list.
But its gives me a compiled-time error.
Here is the actual code:
class Node
{
private:
string value;
Node* next;
public:
~Node(){del ete this;};
Node* operator++(int);
Node* operator++();
}
Node* Node::operator++()
{
this = this->next; //error message
return this;
}
Node* Node::operator++(int)
{
Node* nodeptr = this;
this = this->next; //error message
return (nodeptr);
}
error message = "lvalue required as left operand of assignment".