我正在尝试理解代码块中的这些错误

I'm trying to understand these errors in the code blocks

本文关键字:错误 代码      更新时间:2023-10-16
Stack::Stack(const Stack& copy)
{
Stack temp;
copyHelper(copy.top, temp);

}
void Stack::copyHelper(Node* top, Stack newStack) {
if (top != nullptr)
{
copyHelper(top->getNext(), newStack);
newStack.push(top->getPayload());
}
}

我收到与上述代码块相关的三个错误:

错误 C2600 'Stack::Stack': 无法定义编译器生成的特殊成员函数(必须先在类中声明( 程序5 C:\Users\tcran\source\repos\Program5\Program5\Stack.cpp 14

错误 C2264 'Stack::Stack':函数定义或声明中出错;函数未调用 Program5 C:\Users\tcran\source\repos\Program5\Program5\Stack.cpp 16

错误 C2264 'Stack::Stack':函数定义或声明中出错;函数未调用 Program5 C:\Users\tcran\source\repos\Program5\Program5\Stack.cpp 23

有人可以详细说明为什么我会收到此错误吗?

class Stack
{
public:
// this constructor has not been specified in your class definition.
Stack(const Stack& copy);
};