It sounds like you want a static const member.
Code:
// Declare in class inside the header file:
class SomeStrings
{
public:
static const std::string A;
static const std::string B;
};
Code:
// Define in a source file:
const std::string SomeStrings::A = "A";
const std::string SomeStrings::B = "B";
Code:
// Example of using the strings somewhere else:
{
std::cout << SomeStrings::A << ',' << SomeStrings::B << '\n';
}
Note that if your class is just storing const strings, you can use a namespace instead of a class. Also note that the example shows strings that are the same across all instances of the class. If you want strings that are const but can be initialized differently by different instances, then you don't want static and you have to use the initializer list to initialize them.