LessonInterfaceC++接口在STL ::列表
class ILesson
{
public:
virtual void PrintLessonName() = 0;
virtual ~ILesson() {}
};
STL容器
typedef list<ILesson> TLessonList;
调用代码
for (TLessonList::const_iterator i = lessons.begin(); i != lessons.end(); i++)
{
i->PrintLessonName();
}
错误:
Description Resource Path Location Type passing ‘const ILesson’ as ‘this’ argument of ‘virtual void ILesson::PrintLessonName()’ discards qualifiers
虽然这是真的,但错误信息插孔已粘贴不是由于此错误。 – sbi 2009-10-21 15:18:57
尝试和错误是: 说明\t \t资源路径\t \t位置类型 请求构件 'PrintLessonName' 在 '* i.std :: _ List_const_iterator <_Tp> ::操作符 - > [与_TP = ILesson *]()',这是非类类型'ILesson * const' – 2009-10-21 15:19:08
我没有观察到const问题,我的眼睛第一次落在'typedef list TLessonList;'。无论如何,他还必须解决这个问题。 –
AraK
2009-10-21 15:21:02