[英]does not have class type
尝试使用以下方法在C ++中的类中遍历向量:
for(vector<Album>::iterator it = a.getAlbumList.begin(); it != a.getAlbumList.end(); it++)
却给了我错误:
错误:“ a.AlbumCollection :: getAlbumList”没有类类型
这让我感到沮丧,因为我不知道这意味着什么,而且我尝试遵循其他建议,但没有帮助。 我只是一个初学者,所以如果有人可以向我简单地解释一下,那将非常感谢。
这是课程:
.cpp: http : //pastebin.com/MSCcHjXb
.h: http : //pastebin.com/Xq4nqSan
您(显然)想调用 getAlbumList
成员函数,因此您的代码应为:
for(vector<Album>::iterator it = a.getAlbumList().begin();
it != a.getAlbumList().end();
it++)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.