Is it possible for a class to have a static string constant member?

Recommended Answers

All 2 Replies

sure :

class A{
    public:
    const static string ClassName; //declare
};
const string A::ClassName = "A";//initialize

sure :

class A{
    public:
    const static string ClassName; //declare
};
const string A::ClassName = "A";//initialize

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.