我有一个班级Response
说。
#include "NetworkResponse.h"
class NetworkResponse;
class Response {
public:
Response();
virtual ~Response();
Response(NetworkResponse * networkResponse);
NetworkResponses responseCode; // This is an enum and here I get an error
};
#endif
NetworkResponses
实际上是在"NetworkResponse.h"
. 像这样:
// "NetworkResponse.h":
#include "Response.h"
enum NetworkResponses {
Success = 1,
UserAlreadyExists = 2,
InvalidUsername = 3,
SecurityError = 4,
UnknownError = 5
};
class Response;
class NetworkResponse {
public:
NetworkResponse();
virtual ~NetworkResponse();
};
但是当我尝试编译时,在类定义中出现错误:“ NetworkResponses没有命名类型” 。Response
有人可以帮忙吗?我想我错过了一些简单的东西。我想我能够在其他类中成功使用这个枚举,不知道在这种情况下出了什么问题......谢谢。