[英]typedef enum is not working C++
I have a very basic question. 我有一个非常基本的问题。
.h 。H
private:
list <int> Stack;
typedef enum
{
Push,
Pop,
Min,
Display
}Operation;
Operation map(string s);
.Cpp: .CPP:
Operation min_Stack::map(string s)
{
The compiler is not complaining for .h file but for .cpp its giving error : "identifier operation is unidentified". 编译器没有抱怨.h文件,而是抱怨.cpp它给出的错误:“标识符操作未识别”。
I am unable to find what I did wrong here. 我在这里找不到我做错了什么。
Instead of 代替
Operation min_Stack::map(string s)
write 写
min_Stack::Operation min_Stack::map(string s)
The compiler searches the return type in the namespace scope and it did not find the name because the name is defined inside class min_Stack. 编译器在名称空间范围内搜索返回类型,但未找到名称,因为该名称在类min_Stack中定义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.