Code:
int main()
{
list<item> itemList;
itemList.push_back(item( "font", "qwer" ));
itemList.push_back(item( "2", "qwer" ));
itemList.push_back(item( "3", "qwer" ));
itemList.push_back(item( "4", "qwer" ));
itemList.push_back(item( "back", "qwer" ));
list<item>::iterator iter;
iter = itemList.begin();
while ( iter != itemList.end() )
{
cout << *iter;
//cout << *iter.getProductID(); //this wont work
iter++;
}
for a progamming assignment ive created a list that contains a growing number of objects. using an itorator to browse threw the list im able to actually cout the item objects because i overloaded the << operator.
unfortunatly i have no idea how i would now gain access to the rest of the functions that my iter is on. if i uncomment the line above heres what i get.
Code:
error C2039: 'getProductID' : is not a member of 'iterator'
i know that technically iter is just a pointer to my objects, but if i dereference it then why wouldnt it be able to use it owns functions???
thanks for any help that somebody might provide. ill be watching this topic closely.