If I have a PRIVATE Node (struct) as part of my List class. I also have a PUBLIC Iterator class as part of my List class.
I have the following dilemma:
Iterator looks like this:
I wrote this function (get_curr()) so in my implementation I could do the following:Code:class Iterator{ private: Node* curr; public: Iterator(Node* c = 0) : curr(c) {} /* etc/operators */ Node* get_curr() const ( return curr; }
where "i" is an iterator object.Code:/* iterate the list to some specific position */ Node* temp = i.get_curr();
Outside of my class, Node is private, but a user CAN use the get_curr() function (though they can never return a Node outside the class.)
Is THIS BAD?