此代码不会编译:
for(vector<Box>::iterator it = shapes.end(); it >= shapes.begin(); --it){
*it.update(1,1);
*it.draw();
}
它声称:
main.cpp:80:17: error: ‘std::vector<Box>::iterator’ has no member named ‘update’
main.cpp:81:17: error: ‘std::vector<Box>::iterator’ has no member named ‘draw’
然而,AFAIK,该代码并没有尝试调用vector::iterator.draw(),它取消了迭代器的引用,它应该给我一个我的类框的对象,它确实有这些方法。我做错了什么,对糟糕的标题感到抱歉。