I am writing a a linked list and I have an Iterator class within my List class.
I want to overload the = operator but I don’t know the correct syntax to start it.
This is what I have in my code
class List{
//member stuff
class Iterator{
private: Node* current;
public: Iterator& operator=(const Iterator& right);
}
}
I am trying this but I am unsure whether this is correct or not.
List::Iterator::operator=(const Iterator& right){
//stuff
}
Can anyone clarify?
To clarify, your thoughts are correct, but you forgot to have a return type in your function declaration:
needs to be