Share useful concept in C++ OOP

  • 2
       Just comment out the last two function means that you do not want to override it, so it uses parent class implementation.  
    int peek() {
            Iterator it(*this);
    // hasNext() and next() should behave the same as in the Iterator interface.
    // Override them if needed.
    /*int next() {
    bool hasNext() const {


Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.