【发布时间】:2014-10-17 01:40:08
【问题描述】:
在我的.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。
【问题讨论】:
标签: c++ class constructor constants copy-constructor