我的 heap.h 文件包含:
bool insert(int key, double data);
在我的 heapCPP.cpp 文件中,我有:
bool heap::insert(int key, double data){
bool returnTemp;
node *temp = new node(key, data);
returnTemp = insert(temp);
delete temp;
return returnTemp;
}
但是,我收到一条错误消息,提示“成员函数“heap::insert”可能不会在其类之外重新声明。
原文由 grillo 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可能在 cpp 中忘记了右括号,这可以解释为在另一个函数中重新声明它。