Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8373523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:41:45+00:00 2026-06-09T14:41:45+00:00

I want to change for example set the ‘Voornaam’ from the object that is

  • 0

I want to change for example set the ‘Voornaam’ from the object that is in the list. But for some reason if I display the objects in list with another function its not changed.

I have made a function “showWielrennerGegevens(*iter);”, this will show all variables from that object. If this function is run, then I can see the changes. But not if I run the function to show object in the list

Please help

void Interface::wijzigPersoneelslid(Wielerploeg& wielerploegOB){

int input,inputWielrennerID,ingavekeuze;
string ingaveString;

int teller=0;

cout << "Wat voor een type wil je wijzigen?" << endl;
cout << "1 - Wielrenner" << endl;
cout << "2 - Dokter" << endl;
cout << "3 - Mecanicien" << endl;
cin >> input;

switch(input)
{
    case 1:{//Wielrenner
        cout << "Wielrenner" << endl;

        list<Wielrenner> wielrennerslist = wielerploegOB.getWielrennersList();
        cout << "Welke wielrenner wil je wijzigen?" << endl;

        // Alle objecten afprinten in de lijst
        for (list<Wielrenner>::iterator it = wielrennerslist.begin(); it != wielrennerslist.end(); it++){
            Wielrenner wielrennerOB = *it;
            cout << teller << " - " << wielrennerOB.getVoornaam() << " " << wielrennerOB.getAchternaam() << endl;
            teller++;
        }
        cin >> inputWielrennerID;

        // Naar het object gaan
        int N = inputWielrennerID; /* index of the element you want to retrieve */
        if (wielrennerslist.size() > N){
            list<Wielrenner>::iterator iter = wielrennerslist.begin();
            std::advance(iter, N);

            // 'it' points to the element at index 'N'

            Wielrenner wielrennerOB2 = *iter;
            //Wielrenner* wielrennerOB2 = *iter;

            cout << "\n De geselecteerde wielrenner is: " << endl;
            cout << " - " << wielrennerOB2.getVoornaam() << wielrennerOB2.getAchternaam() << endl;

            cout << "\n Wat wil je aanpassen?" << endl;
            cout << "1 - Voornaam" << endl;
            cout << "2 - Achternaam" << endl;
            cout << "3 - Telefoon" << endl;
            cin >> ingavekeuze;
            switch(ingavekeuze)                                                                                                                                                 
            {
                case 1:{ // voornaam
                    cout << "Ingave voornaam: ";
                    cin >> ingaveString;
                    //wielrennerOB2.setVoornaam(ingaveString);
                    (*iter).setVoornaam(ingaveString);

                    cout << "object " << endl;
                    showWielrennerGegevens(*iter);
                    break;
                }
                case 2:{ // achternaam
                    cout << "Ingave achternaam: ";
                    cin >> ingaveString;
                    wielrennerOB2.setAchternaam(ingaveString);

                    cout << "object " << endl;
                    showWielrennerGegevens(wielrennerOB2);
                    break;
                }
                case 3:{ // telefoon
                    cout << "Ingave telefoon: ";
                    cin >> ingaveString;
                    wielrennerOB2.setTelefoon(ingaveString);
                    break;
                }
                default:{
                    cout << "Switch Default waarde - wielrenner wijzig" << endl;
                }
            }
        }// if statement
        break;
    }// case 1
    case 2:{ // dokter
        cout << "Dokter" << endl;
        break;
    }
    default:{
        cout << "Switch Default waarde - Interface" << endl;
    }
} // switch

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:41:47+00:00Added an answer on June 9, 2026 at 2:41 pm

    I think this is happening because you have made a copy of your list. You are changing the copy but not the original.

    list<Wielrenner> wielrennerslist = wielerploegOB.getWielrennersList();
    

    This line makes a copy of the list.

    What to do next is harder to say. Perhaps you need to do this?

    list<Wielrenner> wielrennerslist = wielerploegOB.getWielrennersList();
    ...
    // make change to wielrennerslist 
    ...
    // copy changed list back to original
    wielerploegOB.setWielrennersList(wielrennerslist);
    

    This will work only if you have a method setWielrennersList, if not then maybe you should write one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to change the source in XAML to another object source. For example:
For example, I have this string that could change anytime I only want the
I want to change the effects of a set variable that is at the
I want to change the default arguments passed to a Ruby function. For example,
I want to change the sprite image. Say for example: mainSprite=[Sprite spriteWithFile:@redFile.png]; [self addChild:mainSprite];
My problem is that i want to change the cell being editable or not
I have a textbox that I want to validate, but when I validate it
I imported a string from another activity, which i want to change into an
It's easy to set inline CSS values with javascript. If I want to change
I have a set of data which I want to display to the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.