1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Objects within lists

Discussion in 'C++' started by Beancounter5, Oct 3, 2010.

  1. Beancounter5

    Beancounter5 New Member

    Joined:
    Oct 3, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    okay , i see ....

    i have situation where i have a list called bunnyList containing mutantType objects, i want to create a new object using a constructor and add this object to my list. Like below.

    bunnyList.push_front( new mutantType );


    with the aid of the newly discovered rbegin pointer i want to look at the last object in the list i've just added and execute a member function from that object....-mutantType. In this case mutantType::printsummary().

    J is my reverse iterator


    J= bunnyList.rbegin();
    (*j)-> printSummary();

    I want to put all this in a for..next loop . Although i get no warnings or compiling errorss, i suspect something is going wrong??. As the loop cycles
    J= bunnyList.rbegin(); points to the newly added object.

    I there anything wrong with this approach???
     

Share This Page