#include <iostream>
using namespace std;
class Assn2
{
public:
static void set_numberofshape();
static void increase_numberofshape();
private:
static int numberofshape22;
};
void Assn2::increase_numberofshape()
{
numberofshape22++;
}
void Assn2::set_numberofshape()
{
numberofshape22=0;
} // there is a problem with my static function declaration
int main()
{
Assn2::set_numberofshape();
}
为什么我在编译时遇到错误undefined reference to Assn2::numberofshape22
?对静态变量和静态方法的未定义参考
我想声明一个静态整数:numberofshape22和两个方法。
方法1个增加numberofshapes22 1
方法2 INITIALISE numberofshape22 0
我在做什么错?
哇...感谢。 – Erutan409