C++ では、クラス内で使用されるいくつかの文字列を定義したいと思いますが、値はすべてのインスタンスで共通になります。CI では s を使用していたでしょう#define。これがその試みです:
#include <string>
class AskBase {
public:
AskBase(){}
private:
static std::string const c_REQ_ROOT = "^Z";
static std::string const c_REQ_PREVIOUS = "^";
static std::string const c_REQ_VERSION = "?v";
static std::string const c_REQ_HELP = "?";
static std::string const c_HELP_MSG = " ? - Help\n ?v - Version\n ^^ - Root\n ^ - Previous\n ^Z - Exit";
};
int main(){AskBase a,b;}
C++0x が必要な場合、それは許容されます。