Static const string won't get initialized

后端 未结 6 1679
一生所求
一生所求 2021-01-13 21:00

I have some static const strings as private members of my C++ class. I am aware of the declaration in .h and definition (and initialization) in .cpp practice. In the class c

6条回答
  •  粉色の甜心
    2021-01-13 21:26

    Is this what you need?

    class blah{
        static const string sz;
    public:
        blah(){
            cout<<"blah constructor - string initialized to: "<

    Program Output: blah constructor - string initialized to: Hello, Blah!

提交回复
热议问题