C++ Static variable and unresolved externals error

后端 未结 2 995
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 06:34

I was hoping I could get some clarification on static variables of a class.

For example: I have two different classes which perform completely different functions,

2条回答
  •  天命终不由人
    2020-12-12 07:09

    static variables inside a class must still be defined somewhere, just like methods:

    Put this in main.cpp:

    beta alpha::var;
    

提交回复
热议问题