简体   繁体   中英

does not have class type

Trying to iterate through a vector in a class in C++ using:

for(vector<Album>::iterator it = a.getAlbumList.begin(); it != a.getAlbumList.end(); it++)

yet it gives me the error:

error: 'a.AlbumCollection::getAlbumList' does not have class type

This is frustrating me as I have no idea what this means, and I have tried to follow other suggestions but to no help. I'm only just a beginner, so if some one could explain this to me simply that would be great thanks.

Here is the class:
.cpp: http://pastebin.com/MSCcHjXb
.h: http://pastebin.com/Xq4nqSan

You (apparently) want to call the getAlbumList member function, so your code should be:

for(vector<Album>::iterator it = a.getAlbumList().begin(); 
                            it != a.getAlbumList().end(); 
                            it++)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM