厦漳轻轨会路过长泰吗:使用“双链表”解决“约瑟夫问题”,程序在编译时给出如下提示

来源:百度文库 编辑:高校问答 时间:2024/04/28 04:37:16
在头文件doublecircle.h中对DblList类进行了定义,
成员函数getData()调用另一个成员函数IsEmpty()时代码如下,但给出接下来的提示信息,去掉if(!IsEmpty()) 后就没有提示错误:
template <class Type> Type DblList<Type>::getData() const{
if(!IsEmpty()) return current->data;
}

提示内容:
doublecircle.h passing `const DblList<int>' as `this' argument of `int DblList<Type>::IsEmpty() [with Type = int]' discards qualifiers