const前面有意外的限定符Id
Unexpected qualifier Id before const
在我的.h
中,我有一个带有结构的类:
class BST
{
public:
struct BinaryNode
{
//variables
BinaryNode& operator=(const BinaryNode node) ;
BinaryNode(SequenceMap i);
~BinaryNode();
BinaryNode(const BinaryNode &otherNode);
};
};
在我的.cpp
中,我实现了我的复制构造函数:
BST::BinaryNode(const BST::BinaryNode &otherNode)
{
item = otherNode.item;
if(otherNode.left != nullptr)
left = otherNode.left;
else
left = nullptr;
if(otherNode.right != nullptr)
right = otherNode.right;
else
right = nullptr;
}
当它编译时,在BST::BinaryNode(const BST::BinaryNode &otherNode)
上,const之前有一个意外的限定符id。
复制构造函数的定义应如下所示:
BST::BinaryNode::BinaryNode(const BST::BinaryNode &otherNode)
//^^^^^^^^^^^^^
{
//...
}
左边的BST::BinaryNode
是类名;右边的CCD_ 5是函数名。
相关文章:
- 从函数角度看ID到文件路径的内部与外部映射
- 通过组合不同的类型来创建唯一的id
- 我不断收到 [错误] ID 返回 1 退出状态错误,但看不到问题所在
- 如何在C++向量中奇数元素前面加上值-1,我在使用insert函数时遇到了问题
- FFMPEG配置文件级别id大小无效
- 方法内部但循环仍得到预期的不合格id错误C++
- 移除前面有空格的前2个字符串
- 如何获取 GLFW 窗口 ID?
- 来自 DLL 的函数调用 [表观调用的括号前面的表达式必须具有(指向-)函数类型]
- 当简单捕获中的标识符显示为参数的声明符 ID 时,没有编译器诊断
- 显示数组中的学生 ID 和最高分
- 如何将一个窗口保留在另一个应用程序窗口的前面
- 如何重写全局方法名称以在调用原始方法之前将我的代码推到前面
- C++:"("令牌"之前有预期的非限定 id 指向类中成员函数的指针
- 在PostgreSQL中根据它们的ID选择大量行的最快方法是什么?
- Xcode 9.4.1 中的 Apple Mach-O 链接器 (id) 错误
- 表观调用前面的表达式必须具有指向 func 类型的指针
- 错误:令牌 { '{' 之前应存在非限定 ID
- 断言"id < 0"在Qt ActiveX中失败
- const前面有意外的限定符Id