samedi 27 avril 2019

Unable to access iterator data member using object

I am trying to overload the operator+, I want to add two nodes using an iterator but I am having problems with accessing the iterator from another object.

Here is my operator+:

 type operator+(const largeInt<type> &other) {
     iter = list.end();
     other.iter = other.list.end() //need help here

     type newNumb1, newNumb2;

     newNumb1 = *iter;
     newNumb2 = other.*iter; //need help here

     return newNumb1 + newNumb2;
 }

I have this typename List<type>::Iterator iter; as a private data member inside the largeInt class.

The iterator class is saved in another class, it is nested within a linkedlist class that is why to make an Iterator object I have to do List<type>::Iterator although it works I am not able to access it using another object as shown above.

Aucun commentaire:

Enregistrer un commentaire