Saturday, 1 December 2012

Week 9_int& operator[](unsigned int index)

int& Queue::operator[] (unsigned int index){
     unsigned int size = this->size();
     Node* idx = _head;
     for(int i=0; i<int(index%size); i++){
         idx = idx->_next;
     }
     return idx->_data;
}

No comments:

Post a Comment