#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 및 두 가지 방법을 선언하려고합니다. 내가 잘못 뭘 오전 0
-1
방법 2 초기화의 numberofshape22에 의해
방법 1 개 증가 numberofshapes22?
와우 ... 감사합니다. – Erutan409