c++ - Iterating through a list of a custom class -
i'm trying iterate through list contains objects of type 'window' (a custom class wrote). loop supposed use gettitle() method of window class on each element , print out title in console.
for reason when try access method through iterator tells me method not exist..
this code:
void center::printwindowlist() { (std::list<window>::iterator = windowlist.begin(); != windowlist.end(); ++it) std::cout << ' ' << *it.gettitle(); }
hope can help
it's issue of operator precedence. try doing it->gettitle()
or (*it).gettitle()
.
Comments
Post a Comment