class magic_square
{
private:
static int n;
int i,j;
int** square;
public:
int set_square(int a);
};
magic_square::set_square(int a)
{
if(a<=1)
cout<<"크기는 1보다 커야 합니다."<<endl;
else n=a;
this->square=new int*[a];
for(i=0;i<a;i++)
for(j=0;j<a;j++)
square[i]=new int[j];
}
?? 맞지않음?
으아악... 에러 코드좀 읊어주세요
(.text+0x3b): undefined reference to `magic_square::n' [Error] ld returned 1 exit status
static int n
요상하네 정의되어 있는데 왜 정의가 안 됬다는 걸까? 이거 클래스 사용 중에 생긴 오류임? 컴파일 에러임?
static 때문이 맞는거같애. 지우니까 제대로 작동함.. ㄳㄳ.
ㅊㄹ//됬->됐 (되어 = 돼임) [리듬 맞춤법 봇♬]