gpt4 book ai didi

c++ - ISO C++ 禁止声明没有类型的 'Stack"

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:56:22 38 4
gpt4 key购买 nike

我已经设置了以下头文件来创建一个使用数组的堆栈。我在第 7 行得到以下内容:

error: ISO C++ forbids declaration of 'Stack" with no type.

我以为类型是输入值。感谢你的帮助。谢谢你。

#ifndef ARRAYSTACKER_H_INCLUDED
#define ARRAYSTACKER_H_INCLUDED
// ArrayStacker.h: header file
class ArrayStack {
int MaxSize;
int EmptyStack;
int top;
int* items;
public:
Stacker(int sizeIn);
~Stacker();
void push(int intIn);
int pop();
int peekIn();
int empty();
int full();
};
#endif // ARRAYSTACKER_H_INCLUDED

最佳答案

构造函数和析构函数具有类的名称,即ArrayStack,而不是Stacker

关于c++ - ISO C++ 禁止声明没有类型的 'Stack",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2687967/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com