相关疑难解决方法(0)

stl :: list中的C++接口

LessonInterface

class ILesson
{
    public:
        virtual void PrintLessonName() = 0;
        virtual ~ILesson() {}
};
Run Code Online (Sandbox Code Playgroud)

stl容器

typedef list<ILesson> TLessonList;
Run Code Online (Sandbox Code Playgroud)

调用代码

for (TLessonList::const_iterator i = lessons.begin(); i != lessons.end(); i++)
    {
        i->PrintLessonName();
    }
Run Code Online (Sandbox Code Playgroud)

错误:

描述资源路径位置类型将'const ILesson'作为'this'参数传递给'virtual void ILesson :: PrintLessonName()',丢弃限定符

c++

2
推荐指数
2
解决办法
2032
查看次数

标签 统计

c++ ×1