Game.h代码:
#ifndef GAME_H
#define GAME_H
class Game
{
public:
const static string QUIT_GAME; // line 8
virtual void playGame() = 0;
};
#endif
错误:
game.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
game.h(8): error C2146: syntax error : missing ';' before identifier 'QUIT_GAME'
game.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
我做错了什么?
最佳答案
你需要做两件事:
-
#include <string>
- 将类型更改为
const static std::string QUIT_GAME
(添加std::
)
关于c++ - 视觉 C++ : Compiler Error C4430,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2916691/