#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